📄 mlrstate.hpp
字号:
SetRenderDeltaMask(int mask)
{ Check_Object(this); renderDeltaMask = mask; }
int
GetRenderDeltaMask() const
{ Check_Object(this); return renderDeltaMask; }
void
SetRenderPermissionMask(int mask)
{ Check_Object(this); renderPermissionMask = mask; }
int
GetRenderPermissionMask() const
{ Check_Object(this); return renderPermissionMask; }
int
GetRenderStateFlags() const
{Check_Object(this); return renderState;}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Process state
//
public:
enum {
PriorityBit = 0,
PriorityBits = 4,
PriorityMask =
(0xFFFFFFFF >> (Stuff::INT_BITS - PriorityBits)) << PriorityBit,
BackFaceBit = PriorityBit + PriorityBits,
BackFaceMask = 1<<BackFaceBit,
LightingBit = BackFaceBit + 1,
LightingBits = 5,
LightingMask =
(0xFFFFFFFF >> (Stuff::INT_BITS - LightingBits)) << LightingBit,
MultitextureBit = LightingBit + LightingBits,
MultitextureBits = 4,
MultitextureMask =
(0xFFFFFFFF >> (Stuff::INT_BITS - MultitextureBits)) << MultitextureBit,
DrawNowBit = MultitextureBit + MultitextureBits,
DrawNowMask = 1<<DrawNowBit,
UsedProcessBits = DrawNowBit + 1,
UsedProcessMask = 0xFFFFFFFF >> (Stuff::INT_BITS - UsedProcessBits)
};
enum BackFaceMode {
BackFaceOffMode = 0,
BackFaceOnMode = 1 << BackFaceBit,
};
enum {
DefaultPriority = 0,
AlphaPriority = 2,
FirstApplicationPriority = 4,
PriorityCount = 1<<PriorityBits,
};
enum LightingMode {
LightingOffMode = 0,
VertexLightingMode = 1 << LightingBit,
LightMapLightingMode = 2 << LightingBit,
LookupLightingMode = 4 << LightingBit,
FaceLightingMode = 8 << LightingBit,
TerrainLightingMode = 16 << LightingBit
};
// if cards are multi texture capable so use this mode
enum MultiTextureMode {
MultiTextureOffMode = 0,
MultiTextureLightmapMode = 1 << MultitextureBit,
MultiTextureSpecularMode = 2 << MultitextureBit,
};
enum DrawNowMode {
DrawNowOffMode = 0,
DrawNowOnMode = 1 << DrawNowBit,
};
// manipulate process state
void
SetBackFaceOn()
{Check_Object(this); processState |= BackFaceOnMode; processDeltaMask |= BackFaceMask;}
void
SetBackFaceOff()
{Check_Object(this); processState &= ~BackFaceOnMode; processDeltaMask |= BackFaceMask;}
BackFaceMode
GetBackFaceMode() const
{Check_Object(this); return static_cast<BackFaceMode>(processState & BackFaceOnMode);}
void
SetPriority(unsigned priority)
{
Check_Object(this); processState &= ~PriorityMask;
processDeltaMask |= PriorityMask;
Verify(priority < PriorityCount); processState |= priority;
}
unsigned
GetPriority() const
{Check_Object(this); return processState & PriorityMask;}
void
SetLightingMode(int lighting)
{Check_Object(this); processState &= ~LightingMask; processState |= lighting; processDeltaMask |= LightingMask;}
int
GetLightingMode() const
{
Check_Object(this);
return static_cast<LightingMode>(processState & LightingMask);
}
void
SetMultiTextureMode(MultiTextureMode multiTex)
{Check_Object(this); processState &= ~MultitextureMask; processState |= multiTex; processDeltaMask |= MultitextureMask;}
MultiTextureMode
GetMultiTextureMode() const
{
Check_Object(this);
return static_cast<MultiTextureMode>(processState & MultitextureMask);
}
void
SetDrawNowOn()
{Check_Object(this); processState |= DrawNowOnMode; processDeltaMask |= DrawNowMask;}
void
SetDrawNowOff()
{Check_Object(this); processState &= ~DrawNowOnMode; processDeltaMask |= DrawNowMask;}
DrawNowMode
GetDrawNowMode() const
{Check_Object(this); return static_cast<DrawNowMode>(processState & DrawNowOnMode);}
void
SetProcessDeltaMask(int mask)
{ Check_Object(this); processDeltaMask = mask; }
int
GetProcessDeltaMask() const
{ Check_Object(this); return processDeltaMask; }
void
SetProcessPermissionMask(int mask)
{ Check_Object(this); processPermissionMask = mask; }
int
GetProcessPermissionMask() const
{ Check_Object(this); return processPermissionMask; }
int
GetProcessStateFlags() const
{Check_Object(this); return processState;}
void
SetRendererState(MLRTexturePool*);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// System flags set at begin of every frame
//
enum {
HasAGPAvailable = 1, // FALSE when no AGP memory available (assume a low end card)
CanMultitextureLightMap = 2, // TRUE when single pass light mapping is available
CanMultitextureSpecularMap = 4, // TRUE when single pass specular mapping is available
HasMaxUVs = 8 // TRUE if video card has certain limits on UVs
};
static void
SetAGPAvailable(bool b)
{ if(b==true) systemFlags |= HasAGPAvailable; else systemFlags &= ~HasAGPAvailable; }
static void
SetMultitextureLightMap(bool b)
{ if(b==true) systemFlags |= CanMultitextureLightMap; else systemFlags &= ~CanMultitextureLightMap; }
static void
SetMultitextureSpecularMap(bool b)
{ if(b==true) systemFlags |= CanMultitextureSpecularMap; else systemFlags &= ~CanMultitextureSpecularMap; }
static void
SetHasMaxUVs(bool b)
{ if(b==true) systemFlags |= HasMaxUVs; else systemFlags &= ~HasMaxUVs; }
static bool
GetAGPAvailable()
{ return (systemFlags & HasAGPAvailable)>0; }
static bool
GetMultitextureLightMap()
{ return (systemFlags & CanMultitextureLightMap)>0; }
static bool
GetMultitextureSpecularMap()
{ return (systemFlags & CanMultitextureSpecularMap)>0; }
static bool
GetHasMaxUVs()
{ return (systemFlags & HasMaxUVs)>0; }
static void
SetMaxUV(float mUV)
{ maxUV = mUV; SetHasMaxUVs(mUV > 0.0f); }
static float
GetMaxUV()
{ return maxUV; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Assignment operators
//
MLRState&
operator=(const int &s)
{Check_Pointer(this); renderState = s; return *this;}
bool
operator==(const MLRState &s) const
{
Check_Pointer(this);
return
renderState == s.renderState
&& processState == s.processState;
}
bool
operator>(const MLRState &s) const
{
Check_Pointer(this);
return
renderState > s.renderState
|| renderState == s.renderState
&& processState > s.processState;
}
bool
operator!=(const MLRState &s) const
{
Check_Pointer(this);
return
renderState != s.renderState
|| processState != s.processState;
}
MLRState&
Combine(
const MLRState &master,
const MLRState &slave
);
friend Stuff::IteratorPosition
GetHashFunctions::GetHashValue(const MLRState &value);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Testing
//
public:
void
TestInstance() const
{}
protected:
int
renderState,
processState,
renderDeltaMask,
renderPermissionMask,
processDeltaMask,
processPermissionMask;
static int
systemFlags;
static float
maxUV;
#ifdef OLDFOG
unsigned int
fogColor;
Stuff::Scalar
fogDensity,
nearFog,
farFog;
#else
public:
static unsigned int
fogColor;
#endif
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -