Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::gfx::StateTable Class Reference

A StateTable represents a collection of graphical state items that affect OpenGL rendering. More...

#include "statetable.h"

Inheritance diagram for ion::gfx::StateTable:
Collaboration diagram for ion::gfx::StateTable:

Public Types

enum  Capability {
  kBlend,
  kCullFace,
  kDebugOutputSynchronous,
  kDepthTest,
  kDither,
  kMultisample,
  kPolygonOffsetFill,
  kSampleAlphaToCoverage,
  kSampleCoverage,
  kScissorTest,
  kStencilTest,
  kNumCapabilities
}
 Enumerated types for StateTable items. More...
 
enum  Value {
  kBlendColorValue,
  kBlendEquationsValue,
  kBlendFunctionsValue,
  kClearColorValue,
  kClearDepthValue,
  kClearStencilValue,
  kColorWriteMasksValue,
  kCullFaceModeValue,
  kFrontFaceModeValue,
  kDepthFunctionValue,
  kDepthRangeValue,
  kDepthWriteMaskValue,
  kDrawBufferValue,
  kHintsValue,
  kLineWidthValue,
  kPolygonOffsetValue,
  kSampleCoverageValue,
  kScissorBoxValue,
  kStencilFunctionsValue,
  kStencilOperationsValue,
  kStencilWriteMasksValue,
  kViewportValue,
  kNumValues
}
 OpenGL state value items. More...
 
enum  BlendEquation {
  kAdd,
  kReverseSubtract,
  kSubtract
}
 Other enumerated types. More...
 
enum  BlendFunctionFactor {
  kConstantAlpha,
  kConstantColor,
  kDstAlpha,
  kDstColor,
  kOne,
  kOneMinusConstantAlpha,
  kOneMinusConstantColor,
  kOneMinusDstAlpha,
  kOneMinusDstColor,
  kOneMinusSrcAlpha,
  kOneMinusSrcColor,
  kSrcAlpha,
  kSrcAlphaSaturate,
  kSrcColor,
  kZero
}
 OpenGL blend function factors. More...
 
enum  ClearMaskBit {
  kClearColorBufferBit,
  kClearDepthBufferBit,
  kClearStencilBufferBit
}
 OpenGL clear mask bits. More...
 
enum  CullFaceMode {
  kCullFront,
  kCullBack,
  kCullFrontAndBack
}
 OpenGL cull face modes. More...
 
enum  DepthFunction {
  kDepthAlways,
  kDepthEqual,
  kDepthGreater,
  kDepthGreaterOrEqual,
  kDepthLess,
  kDepthLessOrEqual,
  kDepthNever,
  kDepthNotEqual
}
 OpenGL depth test functions. More...
 
enum  DrawBuffer {
  kBack,
  kBackLeft,
  kBackRight,
  kFront,
  kFrontAndBack,
  kFrontLeft,
  kFrontRight,
  kLeft,
  kNone,
  kRight
}
 OpenGL draw buffers. More...
 
enum  FrontFaceMode {
  kClockwise,
  kCounterClockwise
}
 OpenGL front face modes. More...
 
enum  HintMode {
  kHintFastest,
  kHintNicest,
  kHintDontCare
}
 OpenGL hint modes. More...
 
enum  HintTarget { kGenerateMipmapHint }
 OpenGL hint targets. More...
 
enum  StencilFunction {
  kStencilAlways,
  kStencilEqual,
  kStencilGreater,
  kStencilGreaterOrEqual,
  kStencilLess,
  kStencilLessOrEqual,
  kStencilNever,
  kStencilNotEqual
}
 OpenGL stencil functions. More...
 
enum  StencilOperation {
  kStencilDecrement,
  kStencilDecrementAndWrap,
  kStencilIncrement,
  kStencilIncrementAndWrap,
  kStencilInvert,
  kStencilKeep,
  kStencilReplace,
  kStencilZero
}
 OpenGL stencil operations. More...
 

Public Member Functions

 StateTable ()
 The constructor initializes the instance to contain all default values. More...
 
 StateTable (int default_width, int default_height)
 
void Reset ()
 Resets all items to their default values. More...
 
void ResetSetState ()
 Resets the "set" state of the StateTable; future calls to IsValueSet() or IsCapabilitySet() will return false until another setting is changed. More...
 
void MarkAllSet ()
 Sets the "set" state to true for all capabilities and values of the StateTable; future calls to IsValueSet() or IsCapabilitySet() will return true until another setting is changed. More...
 
void CopyFrom (const StateTable &other)
 Copies all state (including the default width and height) from another instance. More...
 
void MergeValuesFrom (const StateTable &other, const StateTable &state_to_test)
 Merges all state that has been set in another instance into this one, using the test bits in state_to_test. More...
 
void MergeNonClearValuesFrom (const StateTable &other, const StateTable &state_to_test)
 The same as MergeValuesFrom() except that clear-related flags (clear color, depth and stencil values, write masks, and scissor box) are not merged. More...
 
void Enable (Capability capability, bool is_enabled)
 Capability item functions. More...
 
bool IsEnabled (Capability capability) const
 Returns a flag indicating whether a capability is enabled. More...
 
size_t GetEnabledCount () const
 Returns the number of capabilities that are enabled in the instance. More...
 
void ResetCapability (Capability capability)
 Resets a capability flag to its default state. More...
 
bool IsCapabilitySet (Capability capability) const
 Returns a flag indicating whether a capability was set since the StateTable was constructed or since the last call to ResetCapability() for that capability. More...
 
size_t GetSetCapabilityCount () const
 Returns the number of capabilities that are set in the instance. More...
 
void ResetValue (Value value)
 Generic value item functions. More...
 
bool IsValueSet (Value value) const
 Returns a flag indicating whether a value was set since the StateTable was constructed or since the last call to ResetValue() for that value. More...
 
size_t GetSetValueCount () const
 Returns the number of values that are set in the instance. More...
 
void SetEnforceSettings (bool enforced)
 Sets/returns whether enforcement is enabled. More...
 
bool AreSettingsEnforced () const
 
void SetBlendColor (const math::Vector4f &color)
 Blending state. More...
 
const math::Vector4f & GetBlendColor () const
 
void SetBlendEquations (BlendEquation rgb_eq, BlendEquation alpha_eq)
 Sets/returns the RGB and alpha blend equations. More...
 
BlendEquation GetRgbBlendEquation () const
 
BlendEquation GetAlphaBlendEquation () const
 
void SetBlendFunctions (BlendFunctionFactor rgb_source_factor, BlendFunctionFactor rgb_destination_factor, BlendFunctionFactor alpha_source_factor, BlendFunctionFactor alpha_destination_factor)
 Sets/returns the source and destination factors for the RGB and alpha blend functions. More...
 
BlendFunctionFactor GetRgbBlendFunctionSourceFactor () const
 
BlendFunctionFactor GetRgbBlendFunctionDestinationFactor () const
 
BlendFunctionFactor GetAlphaBlendFunctionSourceFactor () const
 
BlendFunctionFactor GetAlphaBlendFunctionDestinationFactor () const
 
void SetClearColor (const math::Vector4f &color)
 Clear state. More...
 
const math::Vector4f & GetClearColor () const
 
void SetClearDepthValue (float value)
 Sets/returns the value to clear depth buffers to. The default is 1. More...
 
float GetClearDepthValue () const
 
void SetClearStencilValue (int value)
 Sets/returns the value to clear stencil buffers to. The default is 0. More...
 
int GetClearStencilValue () const
 
void SetColorWriteMasks (bool red, bool green, bool blue, bool alpha)
 Color state. More...
 
bool GetRedColorWriteMask () const
 
bool GetGreenColorWriteMask () const
 
bool GetBlueColorWriteMask () const
 
bool GetAlphaColorWriteMask () const
 
void SetCullFaceMode (CullFaceMode mode)
 Face culling state. More...
 
CullFaceMode GetCullFaceMode () const
 
void SetFrontFaceMode (FrontFaceMode mode)
 Sets/returns which faces are considered front-facing. More...
 
FrontFaceMode GetFrontFaceMode () const
 
void SetDepthFunction (DepthFunction func)
 Depth buffer state. More...
 
DepthFunction GetDepthFunction () const
 
void SetDepthRange (const math::Range1f &range)
 Sets/returns the range to use for mapping depth values. More...
 
const math::Range1fGetDepthRange () const
 
void SetDepthWriteMask (bool mask)
 Sets/returns whether depth values will be written. The default is true. More...
 
bool GetDepthWriteMask () const
 
void SetDrawBuffer (DrawBuffer draw_buffer)
 Draw buffer state. More...
 
DrawBuffer GetDrawBuffer () const
 Returns the target draw buffer. More...
 
void SetHint (HintTarget target, HintMode mode)
 Hint state. More...
 
HintMode GetHint (HintTarget target) const
 
void SetLineWidth (float width)
 Line width state. More...
 
float GetLineWidth () const
 
void SetPolygonOffset (float factor, float units)
 Polygon offset state. More...
 
float GetPolygonOffsetFactor () const
 
float GetPolygonOffsetUnits () const
 
void SetSampleCoverage (float value, bool is_inverted)
 Sample coverage state. More...
 
float GetSampleCoverageValue () const
 
bool IsSampleCoverageInverted () const
 
void SetScissorBox (const math::Range2i &box)
 Scissoring state. More...
 
const math::Range2iGetScissorBox () const
 
void SetStencilFunctions (StencilFunction front_func, int front_reference_value, uint32 front_mask, StencilFunction back_func, int back_reference_value, uint32 back_mask)
 Stenciling state. More...
 
StencilFunction GetFrontStencilFunction () const
 
StencilFunction GetBackStencilFunction () const
 
int GetFrontStencilReferenceValue () const
 
int GetBackStencilReferenceValue () const
 
uint32 GetFrontStencilMask () const
 
uint32 GetBackStencilMask () const
 
void SetStencilOperations (StencilOperation front_stencil_fail, StencilOperation front_depth_fail, StencilOperation front_pass, StencilOperation back_stencil_fail, StencilOperation back_depth_fail, StencilOperation back_pass)
 Sets/returns the stencil test actions for front and back faces. More...
 
StencilOperation GetFrontStencilFailOperation () const
 
StencilOperation GetFrontStencilDepthFailOperation () const
 
StencilOperation GetFrontStencilPassOperation () const
 
StencilOperation GetBackStencilFailOperation () const
 
StencilOperation GetBackStencilDepthFailOperation () const
 
StencilOperation GetBackStencilPassOperation () const
 
void SetStencilWriteMasks (uint32 front_mask, uint32 back_mask)
 Sets/returns a mask indicating which stencil bits will be written for front and back faces. More...
 
uint32 GetFrontStencilWriteMask () const
 
uint32 GetBackStencilWriteMask () const
 
void SetViewport (const math::Range2i &rect)
 Viewport state. More...
 
void SetViewport (int left, int bottom, int width, int height)
 
const math::Range2iGetViewport () const
 Returns the viewport rectangle. More...
 
const AllocatorPtr & GetAllocator () const
 Returns the Allocator that was used for the instance. More...
 
const AllocatorPtr & GetNonNullAllocator () const
 Return our allocator, or the default allocator if the instance was declared on the stack. More...
 
const AllocatorPtr & GetAllocatorForLifetime (AllocationLifetime lifetime) const
 Convenience function that returns the Allocator to use to allocate an object with a specific lifetime. More...
 
void * operator new (size_t size)
 The standard no-parameter new operator uses the default Allocator. More...
 
void * operator new (size_t size, AllocationLifetime lifetime)
 This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime. More...
 
void * operator new (size_t size, const AllocatorPtr &allocator)
 This overloaded version of the new operator takes the Allocator to use directly as a parameter. More...
 
void * operator new (size_t size, const AllocatorPtr &allocator, void *ptr)
 Special operator new for using placement new with Allocatables. More...
 
void * operator new (size_t size, void *ptr)
 The placement new operator is defined conventionally. More...
 
void operator delete (void *ptr)
 Define the delete operator to use specialized functions dealing with an Allocator. More...
 
void operator delete (void *ptr, AllocationLifetime lifetime)
 Windows requires these (or it issues C4291 warnings). More...
 
void operator delete (void *ptr, const AllocatorPtr &allocator)
 
void operator delete (void *ptr, void *ptr2)
 The placement delete operator does nothing, as usual. More...
 
int GetRefCount () const
 GetRefCount() is part of the interface necessary for SharedPtr. More...
 

Static Public Member Functions

static bool AreCapabilitiesSame (const StateTable &st0, const StateTable &st1)
 Returns true if the capabilities set in two instances are the same. More...
 
static int GetCapabilityCount ()
 Returns the number of Capabilities. More...
 
static int GetValueCount ()
 Returns the number of Values. More...
 
template<typename EnumType >
static const char * GetEnumString (EnumType value)
 Returns a string representation of a StateTable enum. More...
 

Protected Member Functions

 ~StateTable () override
 The destructor is protected because all base::Referent classes must have protected or private destructors. More...
 

Detailed Description

A StateTable represents a collection of graphical state items that affect OpenGL rendering.

State items are divided into two broad categories: capabilities and values. Capabilities are Boolean flags that are set in OpenGL with glEnable() or glDisable(). Values are all other global state items, arranged into meaningful categories.

Each item has an is-set flag indicating whether that item has been set in this StateTable instance since construction or the last call to ResetSetState(). There is a Reset() function for each item that returns the item to its default value and clears the is-set flag. A default-constructed StateTable has each item initialized to its OpenGL default state and its is-set flag initialized to false. Setting any capability or value item causes its is-set flag to be set to true. Only items for which is-set is true are considered when applying changes to rendering state. Calling ResetSetState() will reset the set flags for both values and capabilities.

Definition at line 48 of file statetable.h.

Member Enumeration Documentation

Other enumerated types.

OpenGL blend equations.

Enumerator
kAdd 
kReverseSubtract 
kSubtract 

Definition at line 103 of file statetable.h.

OpenGL blend function factors.

Enumerator
kConstantAlpha 
kConstantColor 
kDstAlpha 
kDstColor 
kOne 
kOneMinusConstantAlpha 
kOneMinusConstantColor 
kOneMinusDstAlpha 
kOneMinusDstColor 
kOneMinusSrcAlpha 
kOneMinusSrcColor 
kSrcAlpha 
kSrcAlphaSaturate 
kSrcColor 
kZero 

Definition at line 110 of file statetable.h.

Enumerated types for StateTable items.

OpenGL capability items. Each can be enabled or disabled.

Enumerator
kBlend 
kCullFace 
kDebugOutputSynchronous 
kDepthTest 
kDither 
kMultisample 
kPolygonOffsetFill 
kSampleAlphaToCoverage 
kSampleCoverage 
kScissorTest 
kStencilTest 
kNumCapabilities 

Definition at line 55 of file statetable.h.

OpenGL clear mask bits.

Enumerator
kClearColorBufferBit 
kClearDepthBufferBit 
kClearStencilBufferBit 

Definition at line 129 of file statetable.h.

OpenGL cull face modes.

Enumerator
kCullFront 
kCullBack 
kCullFrontAndBack 

Definition at line 136 of file statetable.h.

OpenGL depth test functions.

Enumerator
kDepthAlways 
kDepthEqual 
kDepthGreater 
kDepthGreaterOrEqual 
kDepthLess 
kDepthLessOrEqual 
kDepthNever 
kDepthNotEqual 

Definition at line 143 of file statetable.h.

OpenGL draw buffers.

Enumerator
kBack 
kBackLeft 
kBackRight 
kFront 
kFrontAndBack 
kFrontLeft 
kFrontRight 
kLeft 
kNone 
kRight 

Definition at line 155 of file statetable.h.

OpenGL front face modes.

Enumerator
kClockwise 
kCounterClockwise 

Definition at line 169 of file statetable.h.

OpenGL hint modes.

Enumerator
kHintFastest 
kHintNicest 
kHintDontCare 

Definition at line 175 of file statetable.h.

OpenGL hint targets.

Enumerator
kGenerateMipmapHint 

Definition at line 182 of file statetable.h.

OpenGL stencil functions.

Enumerator
kStencilAlways 
kStencilEqual 
kStencilGreater 
kStencilGreaterOrEqual 
kStencilLess 
kStencilLessOrEqual 
kStencilNever 
kStencilNotEqual 

Definition at line 187 of file statetable.h.

OpenGL stencil operations.

Enumerator
kStencilDecrement 
kStencilDecrementAndWrap 
kStencilIncrement 
kStencilIncrementAndWrap 
kStencilInvert 
kStencilKeep 
kStencilReplace 
kStencilZero 

Definition at line 199 of file statetable.h.

OpenGL state value items.

Each of these may actually represent multiple values that are passed in unison to a single OpenGL function.

Enumerator
kBlendColorValue 
kBlendEquationsValue 
kBlendFunctionsValue 
kClearColorValue 
kClearDepthValue 
kClearStencilValue 
kColorWriteMasksValue 
kCullFaceModeValue 
kFrontFaceModeValue 
kDepthFunctionValue 
kDepthRangeValue 
kDepthWriteMaskValue 
kDrawBufferValue 
kHintsValue 
kLineWidthValue 
kPolygonOffsetValue 
kSampleCoverageValue 
kScissorBoxValue 
kStencilFunctionsValue 
kStencilOperationsValue 
kStencilWriteMasksValue 
kViewportValue 
kNumValues 

Definition at line 72 of file statetable.h.

Constructor & Destructor Documentation

ion::gfx::StateTable::StateTable ( )
inline

The constructor initializes the instance to contain all default values.

It is passed the default width and height that are used to initialize the viewport and scissor box correctly. If the default constructor is used the default width and height are initialized to zero.

Definition at line 217 of file statetable.h.

ion::gfx::StateTable::StateTable ( int  default_width,
int  default_height 
)
inline

Definition at line 222 of file statetable.h.

ion::gfx::StateTable::~StateTable ( )
overrideprotected

The destructor is protected because all base::Referent classes must have protected or private destructors.

Definition at line 29 of file statetable.cc.

Member Function Documentation

static bool ion::gfx::StateTable::AreCapabilitiesSame ( const StateTable st0,
const StateTable st1 
)
inlinestatic

Returns true if the capabilities set in two instances are the same.

Definition at line 315 of file statetable.h.

Referenced by MergeNonClearValuesFrom(), and ion::gfx::UpdateFromStateTable().

bool ion::gfx::StateTable::AreSettingsEnforced ( ) const
inline

Definition at line 350 of file statetable.h.

Referenced by MergeNonClearValuesFrom(), and ion::gfx::UpdateFromStateTable().

void ion::gfx::StateTable::CopyFrom ( const StateTable other)

Copies all state (including the default width and height) from another instance.

Definition at line 42 of file statetable.cc.

void ion::gfx::StateTable::Enable ( Capability  capability,
bool  is_enabled 
)
inline

Capability item functions.

Sets a flag indicating whether a capability is enabled.

Definition at line 278 of file statetable.h.

const AllocatorPtr& ion::base::Allocatable::GetAllocator ( ) const
inlineinherited

Returns the Allocator that was used for the instance.

This will be NULL if the instance was declared on the stack or created with normal placement new.

Definition at line 68 of file allocatable.h.

References allocator_.

Referenced by ion::base::DataContainer::CreateAndCopy(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), and ion::text::DynamicFontImage::FindImageDataIndex().

const AllocatorPtr& ion::base::Allocatable::GetAllocatorForLifetime ( AllocationLifetime  lifetime) const
inlineinherited
BlendEquation ion::gfx::StateTable::GetAlphaBlendEquation ( ) const
inline

Definition at line 364 of file statetable.h.

BlendFunctionFactor ion::gfx::StateTable::GetAlphaBlendFunctionDestinationFactor ( ) const
inline

Definition at line 383 of file statetable.h.

BlendFunctionFactor ion::gfx::StateTable::GetAlphaBlendFunctionSourceFactor ( ) const
inline

Definition at line 380 of file statetable.h.

bool ion::gfx::StateTable::GetAlphaColorWriteMask ( ) const
inline

Definition at line 413 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetBackStencilDepthFailOperation ( ) const
inline

Definition at line 547 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetBackStencilFailOperation ( ) const
inline

Definition at line 544 of file statetable.h.

StencilFunction ion::gfx::StateTable::GetBackStencilFunction ( ) const
inline

Definition at line 515 of file statetable.h.

uint32 ion::gfx::StateTable::GetBackStencilMask ( ) const
inline

Definition at line 525 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetBackStencilPassOperation ( ) const
inline

Definition at line 550 of file statetable.h.

int ion::gfx::StateTable::GetBackStencilReferenceValue ( ) const
inline

Definition at line 521 of file statetable.h.

uint32 ion::gfx::StateTable::GetBackStencilWriteMask ( ) const
inline

Definition at line 560 of file statetable.h.

const math::Vector4f& ion::gfx::StateTable::GetBlendColor ( ) const
inline

Definition at line 358 of file statetable.h.

bool ion::gfx::StateTable::GetBlueColorWriteMask ( ) const
inline

Definition at line 412 of file statetable.h.

static int ion::gfx::StateTable::GetCapabilityCount ( )
inlinestatic

Returns the number of Capabilities.

Definition at line 321 of file statetable.h.

const math::Vector4f& ion::gfx::StateTable::GetClearColor ( ) const
inline

Definition at line 393 of file statetable.h.

float ion::gfx::StateTable::GetClearDepthValue ( ) const
inline

Definition at line 397 of file statetable.h.

int ion::gfx::StateTable::GetClearStencilValue ( ) const
inline

Definition at line 401 of file statetable.h.

CullFaceMode ion::gfx::StateTable::GetCullFaceMode ( ) const
inline

Definition at line 422 of file statetable.h.

DepthFunction ion::gfx::StateTable::GetDepthFunction ( ) const
inline

Definition at line 436 of file statetable.h.

const math::Range1f& ion::gfx::StateTable::GetDepthRange ( ) const
inline

Definition at line 441 of file statetable.h.

bool ion::gfx::StateTable::GetDepthWriteMask ( ) const
inline

Definition at line 445 of file statetable.h.

DrawBuffer ion::gfx::StateTable::GetDrawBuffer ( ) const
inline

Returns the target draw buffer.

Definition at line 454 of file statetable.h.

size_t ion::gfx::StateTable::GetEnabledCount ( ) const
inline

Returns the number of capabilities that are enabled in the instance.

Definition at line 289 of file statetable.h.

template<typename EnumType >
static const char* ion::gfx::StateTable::GetEnumString ( EnumType  value)
static

Returns a string representation of a StateTable enum.

For example, passsing kPolygonOffsetFill will return "PolygonOffsetFill".

FrontFaceMode ion::gfx::StateTable::GetFrontFaceMode ( ) const
inline

Definition at line 427 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetFrontStencilDepthFailOperation ( ) const
inline

Definition at line 538 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetFrontStencilFailOperation ( ) const
inline

Definition at line 535 of file statetable.h.

StencilFunction ion::gfx::StateTable::GetFrontStencilFunction ( ) const
inline

Definition at line 512 of file statetable.h.

uint32 ion::gfx::StateTable::GetFrontStencilMask ( ) const
inline

Definition at line 524 of file statetable.h.

StencilOperation ion::gfx::StateTable::GetFrontStencilPassOperation ( ) const
inline

Definition at line 541 of file statetable.h.

int ion::gfx::StateTable::GetFrontStencilReferenceValue ( ) const
inline

Definition at line 518 of file statetable.h.

uint32 ion::gfx::StateTable::GetFrontStencilWriteMask ( ) const
inline

Definition at line 557 of file statetable.h.

bool ion::gfx::StateTable::GetGreenColorWriteMask ( ) const
inline

Definition at line 411 of file statetable.h.

HintMode ion::gfx::StateTable::GetHint ( HintTarget  target) const
inline

Definition at line 462 of file statetable.h.

float ion::gfx::StateTable::GetLineWidth ( ) const
inline

Definition at line 470 of file statetable.h.

const AllocatorPtr& ion::base::Allocatable::GetNonNullAllocator ( ) const
inlineinherited

Return our allocator, or the default allocator if the instance was declared on the stack.

Definition at line 72 of file allocatable.h.

References allocator_, and ion::base::AllocationManager::GetNonNullAllocator().

float ion::gfx::StateTable::GetPolygonOffsetFactor ( ) const
inline

Definition at line 479 of file statetable.h.

float ion::gfx::StateTable::GetPolygonOffsetUnits ( ) const
inline

Definition at line 480 of file statetable.h.

bool ion::gfx::StateTable::GetRedColorWriteMask ( ) const
inline

Definition at line 410 of file statetable.h.

int ion::base::Shareable::GetRefCount ( ) const
inlineinherited

GetRefCount() is part of the interface necessary for SharedPtr.

Definition at line 34 of file shareable.h.

Referenced by ion::base::Notifier::RemoveReceiver().

BlendEquation ion::gfx::StateTable::GetRgbBlendEquation ( ) const
inline

Definition at line 363 of file statetable.h.

BlendFunctionFactor ion::gfx::StateTable::GetRgbBlendFunctionDestinationFactor ( ) const
inline

Definition at line 377 of file statetable.h.

BlendFunctionFactor ion::gfx::StateTable::GetRgbBlendFunctionSourceFactor ( ) const
inline

Definition at line 374 of file statetable.h.

float ion::gfx::StateTable::GetSampleCoverageValue ( ) const
inline

Definition at line 489 of file statetable.h.

const math::Range2i& ion::gfx::StateTable::GetScissorBox ( ) const
inline

Definition at line 500 of file statetable.h.

size_t ion::gfx::StateTable::GetSetCapabilityCount ( ) const
inline

Returns the number of capabilities that are set in the instance.

Definition at line 310 of file statetable.h.

Referenced by MergeNonClearValuesFrom(), and ion::gfx::UpdateFromStateTable().

size_t ion::gfx::StateTable::GetSetValueCount ( ) const
inline

Returns the number of values that are set in the instance.

Definition at line 337 of file statetable.h.

Referenced by ion::gfx::ClearFromStateTable(), MergeNonClearValuesFrom(), MergeValuesFrom(), and ion::gfx::UpdateFromStateTable().

static int ion::gfx::StateTable::GetValueCount ( )
inlinestatic

Returns the number of Values.

Definition at line 342 of file statetable.h.

const math::Range2i& ion::gfx::StateTable::GetViewport ( ) const
inline

Returns the viewport rectangle.

Definition at line 572 of file statetable.h.

bool ion::gfx::StateTable::IsCapabilitySet ( Capability  capability) const
inline

Returns a flag indicating whether a capability was set since the StateTable was constructed or since the last call to ResetCapability() for that capability.

Definition at line 305 of file statetable.h.

bool ion::gfx::StateTable::IsEnabled ( Capability  capability) const
inline

Returns a flag indicating whether a capability is enabled.

Definition at line 284 of file statetable.h.

bool ion::gfx::StateTable::IsSampleCoverageInverted ( ) const
inline

Definition at line 490 of file statetable.h.

bool ion::gfx::StateTable::IsValueSet ( Value  value) const
inline

Returns a flag indicating whether a value was set since the StateTable was constructed or since the last call to ResetValue() for that value.

Definition at line 332 of file statetable.h.

Referenced by MergeNonClearValuesFrom().

void ion::gfx::StateTable::MarkAllSet ( )
inline

Sets the "set" state to true for all capabilities and values of the StateTable; future calls to IsValueSet() or IsCapabilitySet() will return true until another setting is changed.

Definition at line 244 of file statetable.h.

void ion::gfx::StateTable::MergeValuesFrom ( const StateTable other,
const StateTable state_to_test 
)

Merges all state that has been set in another instance into this one, using the test bits in state_to_test.

State will be changed in this only if it is marked as changed in state_to_test. This is useful for only copying partial StateTables and for undoing changes made by a StateTable, for example:

saved_st->CopyFrom(current_st); ///< Save the current state. current_st->MergeValuesFrom(new_st, new_st); ///< Make some changes. ... current_st->MergeValuesFrom(saved_st, new_st); ///< Restore original state ///< while properly setting ///< set bits.

Definition at line 78 of file statetable.cc.

References GetSetValueCount(), ION_UPDATE_VALUE, kClearColorValue, kClearDepthValue, kClearStencilValue, and MergeNonClearValuesFrom().

void ion::base::Allocatable::operator delete ( void *  ptr)
inlineinherited

Define the delete operator to use specialized functions dealing with an Allocator.

Definition at line 109 of file allocatable.h.

void ion::base::Allocatable::operator delete ( void *  ptr,
AllocationLifetime  lifetime 
)
inlineinherited

Windows requires these (or it issues C4291 warnings).

Definition at line 112 of file allocatable.h.

void ion::base::Allocatable::operator delete ( void *  ptr,
const AllocatorPtr allocator 
)
inlineinherited

Definition at line 113 of file allocatable.h.

void ion::base::Allocatable::operator delete ( void *  ptr,
void *  ptr2 
)
inlineinherited

The placement delete operator does nothing, as usual.

Definition at line 118 of file allocatable.h.

void* ion::base::Allocatable::operator new ( size_t  size)
inlineinherited

The standard no-parameter new operator uses the default Allocator.

Definition at line 84 of file allocatable.h.

void* ion::base::Allocatable::operator new ( size_t  size,
AllocationLifetime  lifetime 
)
inlineinherited

This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime.

Definition at line 88 of file allocatable.h.

void* ion::base::Allocatable::operator new ( size_t  size,
const AllocatorPtr allocator 
)
inlineinherited

This overloaded version of the new operator takes the Allocator to use directly as a parameter.

If the Allocator pointer is NULL, this uses the default Allocator.

Definition at line 95 of file allocatable.h.

void* ion::base::Allocatable::operator new ( size_t  size,
const AllocatorPtr allocator,
void *  ptr 
)
inlineinherited

Special operator new for using placement new with Allocatables.

Definition at line 100 of file allocatable.h.

void* ion::base::Allocatable::operator new ( size_t  size,
void *  ptr 
)
inlineinherited

The placement new operator is defined conventionally.

Definition at line 105 of file allocatable.h.

void ion::gfx::StateTable::Reset ( )

Resets all items to their default values.

All capabilities are disabled except for kDither, which is enabled, and all other values are set to their documented defaults. The window size is used to set the scissor box and viewport values.

Definition at line 32 of file statetable.cc.

Referenced by ion::gfx::UpdateStateTable().

void ion::gfx::StateTable::ResetCapability ( Capability  capability)
inline

Resets a capability flag to its default state.

Definition at line 294 of file statetable.h.

void ion::gfx::StateTable::ResetSetState ( )
inline

Resets the "set" state of the StateTable; future calls to IsValueSet() or IsCapabilitySet() will return false until another setting is changed.

Definition at line 236 of file statetable.h.

void ion::gfx::StateTable::SetBlendColor ( const math::Vector4f &  color)

Blending state.

Sets/returns the blend color. The default is (0,0,0,0).

Definition at line 283 of file statetable.cc.

References kBlendColorValue.

void ion::gfx::StateTable::SetBlendEquations ( BlendEquation  rgb_eq,
BlendEquation  alpha_eq 
)

Sets/returns the RGB and alpha blend equations.

The default is kAdd for both.

Definition at line 288 of file statetable.cc.

References kBlendEquationsValue.

void ion::gfx::StateTable::SetBlendFunctions ( BlendFunctionFactor  rgb_source_factor,
BlendFunctionFactor  rgb_destination_factor,
BlendFunctionFactor  alpha_source_factor,
BlendFunctionFactor  alpha_destination_factor 
)

Sets/returns the source and destination factors for the RGB and alpha blend functions.

The default is kOne for source and kZero for destination.

Definition at line 295 of file statetable.cc.

References kBlendFunctionsValue.

void ion::gfx::StateTable::SetClearColor ( const math::Vector4f &  color)

Clear state.

Color state.

Sets/returns the color to clear color buffers to. The default is (0,0,0,0).

Definition at line 311 of file statetable.cc.

References kClearColorValue.

void ion::gfx::StateTable::SetClearDepthValue ( float  value)

Sets/returns the value to clear depth buffers to. The default is 1.

Depth buffer state.

Definition at line 345 of file statetable.cc.

References kClearDepthValue, and value.

void ion::gfx::StateTable::SetClearStencilValue ( int  value)

Sets/returns the value to clear stencil buffers to. The default is 0.

Definition at line 453 of file statetable.cc.

References kClearStencilValue, and value.

void ion::gfx::StateTable::SetColorWriteMasks ( bool  red,
bool  green,
bool  blue,
bool  alpha 
)

Color state.

Sets/returns the mask to use when writing colors. The default is true for all components.

Definition at line 316 of file statetable.cc.

References kColorWriteMasksValue.

void ion::gfx::StateTable::SetCullFaceMode ( CullFaceMode  mode)

Face culling state.

Sets/returns which faces are culled when culling is enabled. The default is kCullBack.

Definition at line 329 of file statetable.cc.

References kCullFaceModeValue.

void ion::gfx::StateTable::SetDepthFunction ( DepthFunction  func)

Depth buffer state.

Sets/returns the function to use for depth testing when enabled. The default is kDepthLess.

Definition at line 350 of file statetable.cc.

References kDepthFunctionValue.

void ion::gfx::StateTable::SetDepthRange ( const math::Range1f range)

Sets/returns the range to use for mapping depth values.

The default is 0 for near_value and 1 for far_value.

Definition at line 355 of file statetable.cc.

References kDepthRangeValue.

void ion::gfx::StateTable::SetDepthWriteMask ( bool  mask)

Sets/returns whether depth values will be written. The default is true.

Definition at line 360 of file statetable.cc.

References kDepthWriteMaskValue.

void ion::gfx::StateTable::SetDrawBuffer ( DrawBuffer  draw_buffer)

Draw buffer state.

Sets the target draw buffer. The default buffer is kBackBuffer.

Definition at line 369 of file statetable.cc.

References kDrawBufferValue.

void ion::gfx::StateTable::SetEnforceSettings ( bool  enforced)
inline

Sets/returns whether enforcement is enabled.

When enforcement is enabled, the capabilities/values that are set in the statetable will be forced applied regardless of what the original settings are.

Definition at line 349 of file statetable.h.

void ion::gfx::StateTable::SetFrontFaceMode ( FrontFaceMode  mode)

Sets/returns which faces are considered front-facing.

The default is kCounterClockwise.

Definition at line 336 of file statetable.cc.

References kFrontFaceModeValue.

void ion::gfx::StateTable::SetHint ( HintTarget  target,
HintMode  mode 
)

Hint state.

Sets/returns a hint value. The default is kHintDontCare for all hints.

Definition at line 378 of file statetable.cc.

References kHintsValue.

void ion::gfx::StateTable::SetLineWidth ( float  width)

Line width state.

Sets/returns the width of rasterized lines, in pixels. The default is 1.

Definition at line 387 of file statetable.cc.

References kLineWidthValue, and width.

void ion::gfx::StateTable::SetPolygonOffset ( float  factor,
float  units 
)

Polygon offset state.

Sets/returns the polygon offset factor and units. The default is 0 for both.

Definition at line 396 of file statetable.cc.

References kPolygonOffsetValue.

void ion::gfx::StateTable::SetSampleCoverage ( float  value,
bool  is_inverted 
)

Sample coverage state.

Sets/returns the sample coverage factor and inversion flag. The default is 1 for value and false for is_inverted.

Definition at line 406 of file statetable.cc.

References kSampleCoverageValue, and value.

void ion::gfx::StateTable::SetScissorBox ( const math::Range2i box)

Scissoring state.

Sets the scissor box. The default state is all zeroes.

Definition at line 416 of file statetable.cc.

References kScissorBoxValue.

void ion::gfx::StateTable::SetStencilFunctions ( StencilFunction  front_func,
int  front_reference_value,
uint32  front_mask,
StencilFunction  back_func,
int  back_reference_value,
uint32  back_mask 
)

Stenciling state.

Sets/returns the function and related values to use for front and back faces when stencils are enabled. The default functions are kStencilAlways, the default reference values are 0, and the default masks are all ones.

Definition at line 425 of file statetable.cc.

References kStencilFunctionsValue.

void ion::gfx::StateTable::SetStencilOperations ( StencilOperation  front_stencil_fail,
StencilOperation  front_depth_fail,
StencilOperation  front_pass,
StencilOperation  back_stencil_fail,
StencilOperation  back_depth_fail,
StencilOperation  back_pass 
)

Sets/returns the stencil test actions for front and back faces.

The default is kStencilKeep for all actions.

Definition at line 437 of file statetable.cc.

References kStencilOperationsValue.

void ion::gfx::StateTable::SetStencilWriteMasks ( uint32  front_mask,
uint32  back_mask 
)

Sets/returns a mask indicating which stencil bits will be written for front and back faces.

The default is all ones for both.

Definition at line 458 of file statetable.cc.

References kStencilWriteMasksValue.

void ion::gfx::StateTable::SetViewport ( const math::Range2i rect)

Viewport state.

Sets the viewport rectangle. The default state is all zeroes.

Definition at line 468 of file statetable.cc.

References kViewportValue.

Referenced by SetViewport().

void ion::gfx::StateTable::SetViewport ( int  left,
int  bottom,
int  width,
int  height 
)

Definition at line 473 of file statetable.cc.

References SetViewport().


The documentation for this class was generated from the following files: