mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Fix line endings and tabs
This commit is contained in:
@ -1,34 +1,34 @@
|
||||
include_directories("../../CoreLib")
|
||||
include_directories("../../NucleusLib")
|
||||
|
||||
set(pnNucleusInc_HEADERS
|
||||
hsGMatState.h
|
||||
hsGMatState.inl
|
||||
hsResMgr.h
|
||||
hsTimer.h
|
||||
plAudible.h
|
||||
plCCRMgrBase.h
|
||||
plClassIndexMacros.h
|
||||
plCreatableIndex.h
|
||||
plCreatableStrings.h
|
||||
plDrawable.h
|
||||
plgDispatch.h
|
||||
plPhysical.h
|
||||
plPipeline.h
|
||||
plPipeResReq.h
|
||||
plProfile.h
|
||||
plProfileManager.h
|
||||
plRefFlags.h
|
||||
pnAllCreatables.h
|
||||
pnNucleusCreatables.h
|
||||
)
|
||||
|
||||
set(pnNucleusInc_SOURCES
|
||||
plProfileManager.cpp
|
||||
pnSingletons.cpp
|
||||
)
|
||||
|
||||
add_library(pnNucleusInc STATIC ${pnNucleusInc_HEADERS} ${pnNucleusInc_SOURCES})
|
||||
|
||||
source_group("Header Files" FILES ${pnNucleusInc_HEADERS})
|
||||
source_group("Source Files" FILES ${pnNucleusInc_SOURCES})
|
||||
include_directories("../../CoreLib")
|
||||
include_directories("../../NucleusLib")
|
||||
|
||||
set(pnNucleusInc_HEADERS
|
||||
hsGMatState.h
|
||||
hsGMatState.inl
|
||||
hsResMgr.h
|
||||
hsTimer.h
|
||||
plAudible.h
|
||||
plCCRMgrBase.h
|
||||
plClassIndexMacros.h
|
||||
plCreatableIndex.h
|
||||
plCreatableStrings.h
|
||||
plDrawable.h
|
||||
plgDispatch.h
|
||||
plPhysical.h
|
||||
plPipeline.h
|
||||
plPipeResReq.h
|
||||
plProfile.h
|
||||
plProfileManager.h
|
||||
plRefFlags.h
|
||||
pnAllCreatables.h
|
||||
pnNucleusCreatables.h
|
||||
)
|
||||
|
||||
set(pnNucleusInc_SOURCES
|
||||
plProfileManager.cpp
|
||||
pnSingletons.cpp
|
||||
)
|
||||
|
||||
add_library(pnNucleusInc STATIC ${pnNucleusInc_HEADERS} ${pnNucleusInc_SOURCES})
|
||||
|
||||
source_group("Header Files" FILES ${pnNucleusInc_HEADERS})
|
||||
source_group("Source Files" FILES ${pnNucleusInc_SOURCES})
|
||||
|
@ -1,253 +1,253 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsGMatState_inc
|
||||
#define hsGMatState_inc
|
||||
|
||||
#include "hsColorRGBA.h"
|
||||
|
||||
class hsStream;
|
||||
|
||||
class hsGMatState {
|
||||
public:
|
||||
enum hsGMatBlendFlags {
|
||||
kBlendTest = 0x1, // dev
|
||||
// Rest of blends are mutually exclusive
|
||||
kBlendAlpha = 0x2, // dev
|
||||
kBlendMult = 0x4, // dev
|
||||
kBlendAdd = 0x8, // dev
|
||||
kBlendAddColorTimesAlpha = 0x10, // dev
|
||||
kBlendAntiAlias = 0x20,
|
||||
kBlendDetail = 0x40,
|
||||
kBlendNoColor = 0x80, // dev
|
||||
kBlendMADD = 0x100,
|
||||
kBlendDot3 = 0x200,
|
||||
kBlendAddSigned = 0x400,
|
||||
kBlendAddSigned2X = 0x800,
|
||||
kBlendMask = kBlendAlpha
|
||||
| kBlendMult
|
||||
| kBlendAdd
|
||||
| kBlendAddColorTimesAlpha
|
||||
| kBlendDetail
|
||||
| kBlendMADD
|
||||
| kBlendDot3
|
||||
| kBlendAddSigned
|
||||
| kBlendAddSigned2X,
|
||||
kBlendInvertAlpha = 0x1000, // dev
|
||||
kBlendInvertColor = 0x2000, // dev
|
||||
kBlendAlphaMult = 0x4000,
|
||||
kBlendAlphaAdd = 0x8000,
|
||||
kBlendNoVtxAlpha = 0x10000,
|
||||
kBlendNoTexColor = 0x20000,
|
||||
kBlendNoTexAlpha = 0x40000,
|
||||
kBlendInvertVtxAlpha = 0x80000, // Invert ONLY the vertex alpha source
|
||||
kBlendAlphaAlways = 0x100000, // Alpha test always passes (even for alpha=0).
|
||||
kBlendInvertFinalColor = 0x200000,
|
||||
kBlendInvertFinalAlpha = 0x400000,
|
||||
kBlendEnvBumpNext = 0x800000,
|
||||
kBlendSubtract = 0x1000000,
|
||||
kBlendRevSubtract = 0x2000000,
|
||||
kBlendAlphaTestHigh = 0x4000000
|
||||
};
|
||||
enum hsGMatClampFlags {
|
||||
|
||||
kClampTextureU = 0x1, // dev
|
||||
kClampTextureV = 0x2, // dev
|
||||
kClampTexture = 0x3 // dev
|
||||
};
|
||||
|
||||
enum hsGMatShadeFlags {
|
||||
|
||||
kShadeSoftShadow = 0x1, // view, dev
|
||||
kShadeNoProjectors = 0x2, // projector
|
||||
kShadeEnvironMap = 0x4, // dev, load
|
||||
kShadeVertexShade = 0x20, // dev
|
||||
kShadeNoShade = 0x40, // view,dev
|
||||
kShadeBlack = kShadeNoShade,
|
||||
kShadeSpecular = 0x80, // view, dev
|
||||
//kShadeNoFog = 0x100, // dev
|
||||
kShadeWhite = 0x200,
|
||||
kShadeSpecularAlpha = 0x400,
|
||||
kShadeSpecularColor = 0x800,
|
||||
kShadeSpecularHighlight = 0x1000,
|
||||
kShadeVertColShade = 0x2000,
|
||||
kShadeInherit = 0x4000,
|
||||
kShadeIgnoreVtxIllum = 0x8000,
|
||||
kShadeEmissive = 0x10000, // Moved here 8.27 mcn. Only really sane to use with kMiscEndPassHere
|
||||
kShadeReallyNoFog = 0x20000
|
||||
};
|
||||
|
||||
enum hsGMatZFlags {
|
||||
kZIncLayer = 0x1, // dev
|
||||
kZClearZ = 0x4, // dev
|
||||
kZNoZRead = 0x8, // dev
|
||||
kZNoZWrite = 0x10,
|
||||
kZMask = kZNoZWrite | kZClearZ | kZNoZRead,
|
||||
kZLODBias = 0x20
|
||||
};
|
||||
|
||||
enum hsGMatMiscFlags {
|
||||
kMiscWireFrame = 0x1, // dev (running out of bits)
|
||||
kMiscDrawMeshOutlines = 0x2, // dev, currently unimplemented
|
||||
kMiscTwoSided = 0x4, // view,dev
|
||||
kMiscDrawAsSplats = 0x8, // dev? bwt
|
||||
kMiscAdjustPlane = 0x10,
|
||||
kMiscAdjustCylinder = 0x20,
|
||||
kMiscAdjustSphere = 0x40,
|
||||
kMiscAdjust = kMiscAdjustPlane | kMiscAdjustCylinder| kMiscAdjustSphere,
|
||||
kMiscTroubledLoner = 0x80,
|
||||
kMiscBindSkip = 0x100,
|
||||
kMiscBindMask = 0x200,
|
||||
kMiscBindNext = 0x400,
|
||||
kMiscLightMap = 0x800,
|
||||
kMiscUseReflectionXform = 0x1000, // Use the calculated reflection environment
|
||||
// texture transform instead of layer->GetTransform()
|
||||
kMiscPerspProjection = 0x2000,
|
||||
kMiscOrthoProjection = 0x4000,
|
||||
kMiscProjection = kMiscPerspProjection | kMiscOrthoProjection,
|
||||
|
||||
kMiscRestartPassHere = 0x8000, // Tells pipeline to start a new pass beginning with this layer
|
||||
// Kinda like troubledLoner, but only cuts off lower layers, not
|
||||
// higher ones (kMiscBindNext sometimes does this by implication)
|
||||
|
||||
kMiscBumpLayer = 0x10000,
|
||||
kMiscBumpDu = 0x20000,
|
||||
kMiscBumpDv = 0x40000,
|
||||
kMiscBumpDw = 0x80000,
|
||||
kMiscBumpChans = kMiscBumpDu | kMiscBumpDv | kMiscBumpDw,
|
||||
|
||||
kMiscNoShadowAlpha = 0x100000,
|
||||
kMiscUseRefractionXform = 0x200000, // Use a refraction-like hack.
|
||||
kMiscCam2Screen = 0x400000, // Expects tex coords to be XYZ in camera space. Does a cam to screen (not NDC) projection
|
||||
// and swaps Z with W, so that the texture projection can produce projected 2D screen coordinates.
|
||||
|
||||
kAllMiscFlags = 0xffffffff
|
||||
};
|
||||
enum StateIdx {
|
||||
kBlend,
|
||||
kClamp,
|
||||
kShade,
|
||||
kZ,
|
||||
kMisc
|
||||
};
|
||||
UInt32 fBlendFlags;
|
||||
UInt32 fClampFlags;
|
||||
UInt32 fShadeFlags;
|
||||
UInt32 fZFlags;
|
||||
UInt32 fMiscFlags;
|
||||
|
||||
static hsBool Differs(UInt32 mine, UInt32 hers, UInt32 mask)
|
||||
{
|
||||
return (mine & mask) ^ (hers & mask);
|
||||
}
|
||||
|
||||
static hsBool Differs(UInt32 mine, UInt32 hers)
|
||||
{
|
||||
return mine ^ hers;
|
||||
}
|
||||
|
||||
hsBool operator!=(const hsGMatState& other)
|
||||
{
|
||||
return ((fBlendFlags ^ other.fBlendFlags)
|
||||
| (fClampFlags ^ other.fClampFlags)
|
||||
| (fShadeFlags ^ other.fShadeFlags)
|
||||
| (fZFlags ^ other.fZFlags)
|
||||
| (fMiscFlags ^ other.fMiscFlags));
|
||||
}
|
||||
UInt32 Value(int i) const
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case kBlend:
|
||||
return fBlendFlags;
|
||||
case kClamp:
|
||||
return fClampFlags;
|
||||
case kShade:
|
||||
return fShadeFlags;
|
||||
case kZ:
|
||||
return fZFlags;
|
||||
case kMisc:
|
||||
return fMiscFlags;
|
||||
}
|
||||
hsAssert(false, "Bad param");
|
||||
return fBlendFlags;
|
||||
}
|
||||
UInt32& operator[](const int i)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case kBlend:
|
||||
return fBlendFlags;
|
||||
case kClamp:
|
||||
return fClampFlags;
|
||||
case kShade:
|
||||
return fShadeFlags;
|
||||
case kZ:
|
||||
return fZFlags;
|
||||
case kMisc:
|
||||
return fMiscFlags;
|
||||
}
|
||||
hsAssert(false, "Bad param");
|
||||
return fBlendFlags;
|
||||
}
|
||||
hsGMatState& operator|=(const hsGMatState& other)
|
||||
{
|
||||
fBlendFlags |= other.fBlendFlags;
|
||||
fClampFlags |= other.fClampFlags;
|
||||
fShadeFlags |= other.fShadeFlags;
|
||||
fZFlags |= other.fZFlags;
|
||||
fMiscFlags |= other.fMiscFlags;
|
||||
return *this;
|
||||
}
|
||||
hsGMatState& operator+=(const hsGMatState& other)
|
||||
{
|
||||
return operator|=(other);
|
||||
}
|
||||
hsGMatState& operator-=(const hsGMatState& other)
|
||||
{
|
||||
fBlendFlags &= ~other.fBlendFlags;
|
||||
fClampFlags &= ~other.fClampFlags;
|
||||
fShadeFlags &= ~other.fShadeFlags;
|
||||
fZFlags &= ~other.fZFlags;
|
||||
fMiscFlags &= ~other.fMiscFlags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Read(hsStream* s);
|
||||
inline void Write(hsStream* s);
|
||||
|
||||
hsGMatState(UInt32 blend=0, UInt32 clamp=0, UInt32 shade=0, UInt32 z=0, UInt32 misc=0)
|
||||
: fBlendFlags(blend),
|
||||
fClampFlags(clamp),
|
||||
fShadeFlags(shade),
|
||||
fZFlags(z),
|
||||
fMiscFlags(misc) {}
|
||||
void Reset() { fBlendFlags = fClampFlags = fShadeFlags = fZFlags = fMiscFlags = 0; }
|
||||
inline void Clear(const hsGMatState& state);
|
||||
inline void Composite(const hsGMatState& want, const hsGMatState& on, const hsGMatState& off);
|
||||
};
|
||||
|
||||
|
||||
#endif // hsGMatState_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsGMatState_inc
|
||||
#define hsGMatState_inc
|
||||
|
||||
#include "hsColorRGBA.h"
|
||||
|
||||
class hsStream;
|
||||
|
||||
class hsGMatState {
|
||||
public:
|
||||
enum hsGMatBlendFlags {
|
||||
kBlendTest = 0x1, // dev
|
||||
// Rest of blends are mutually exclusive
|
||||
kBlendAlpha = 0x2, // dev
|
||||
kBlendMult = 0x4, // dev
|
||||
kBlendAdd = 0x8, // dev
|
||||
kBlendAddColorTimesAlpha = 0x10, // dev
|
||||
kBlendAntiAlias = 0x20,
|
||||
kBlendDetail = 0x40,
|
||||
kBlendNoColor = 0x80, // dev
|
||||
kBlendMADD = 0x100,
|
||||
kBlendDot3 = 0x200,
|
||||
kBlendAddSigned = 0x400,
|
||||
kBlendAddSigned2X = 0x800,
|
||||
kBlendMask = kBlendAlpha
|
||||
| kBlendMult
|
||||
| kBlendAdd
|
||||
| kBlendAddColorTimesAlpha
|
||||
| kBlendDetail
|
||||
| kBlendMADD
|
||||
| kBlendDot3
|
||||
| kBlendAddSigned
|
||||
| kBlendAddSigned2X,
|
||||
kBlendInvertAlpha = 0x1000, // dev
|
||||
kBlendInvertColor = 0x2000, // dev
|
||||
kBlendAlphaMult = 0x4000,
|
||||
kBlendAlphaAdd = 0x8000,
|
||||
kBlendNoVtxAlpha = 0x10000,
|
||||
kBlendNoTexColor = 0x20000,
|
||||
kBlendNoTexAlpha = 0x40000,
|
||||
kBlendInvertVtxAlpha = 0x80000, // Invert ONLY the vertex alpha source
|
||||
kBlendAlphaAlways = 0x100000, // Alpha test always passes (even for alpha=0).
|
||||
kBlendInvertFinalColor = 0x200000,
|
||||
kBlendInvertFinalAlpha = 0x400000,
|
||||
kBlendEnvBumpNext = 0x800000,
|
||||
kBlendSubtract = 0x1000000,
|
||||
kBlendRevSubtract = 0x2000000,
|
||||
kBlendAlphaTestHigh = 0x4000000
|
||||
};
|
||||
enum hsGMatClampFlags {
|
||||
|
||||
kClampTextureU = 0x1, // dev
|
||||
kClampTextureV = 0x2, // dev
|
||||
kClampTexture = 0x3 // dev
|
||||
};
|
||||
|
||||
enum hsGMatShadeFlags {
|
||||
|
||||
kShadeSoftShadow = 0x1, // view, dev
|
||||
kShadeNoProjectors = 0x2, // projector
|
||||
kShadeEnvironMap = 0x4, // dev, load
|
||||
kShadeVertexShade = 0x20, // dev
|
||||
kShadeNoShade = 0x40, // view,dev
|
||||
kShadeBlack = kShadeNoShade,
|
||||
kShadeSpecular = 0x80, // view, dev
|
||||
//kShadeNoFog = 0x100, // dev
|
||||
kShadeWhite = 0x200,
|
||||
kShadeSpecularAlpha = 0x400,
|
||||
kShadeSpecularColor = 0x800,
|
||||
kShadeSpecularHighlight = 0x1000,
|
||||
kShadeVertColShade = 0x2000,
|
||||
kShadeInherit = 0x4000,
|
||||
kShadeIgnoreVtxIllum = 0x8000,
|
||||
kShadeEmissive = 0x10000, // Moved here 8.27 mcn. Only really sane to use with kMiscEndPassHere
|
||||
kShadeReallyNoFog = 0x20000
|
||||
};
|
||||
|
||||
enum hsGMatZFlags {
|
||||
kZIncLayer = 0x1, // dev
|
||||
kZClearZ = 0x4, // dev
|
||||
kZNoZRead = 0x8, // dev
|
||||
kZNoZWrite = 0x10,
|
||||
kZMask = kZNoZWrite | kZClearZ | kZNoZRead,
|
||||
kZLODBias = 0x20
|
||||
};
|
||||
|
||||
enum hsGMatMiscFlags {
|
||||
kMiscWireFrame = 0x1, // dev (running out of bits)
|
||||
kMiscDrawMeshOutlines = 0x2, // dev, currently unimplemented
|
||||
kMiscTwoSided = 0x4, // view,dev
|
||||
kMiscDrawAsSplats = 0x8, // dev? bwt
|
||||
kMiscAdjustPlane = 0x10,
|
||||
kMiscAdjustCylinder = 0x20,
|
||||
kMiscAdjustSphere = 0x40,
|
||||
kMiscAdjust = kMiscAdjustPlane | kMiscAdjustCylinder| kMiscAdjustSphere,
|
||||
kMiscTroubledLoner = 0x80,
|
||||
kMiscBindSkip = 0x100,
|
||||
kMiscBindMask = 0x200,
|
||||
kMiscBindNext = 0x400,
|
||||
kMiscLightMap = 0x800,
|
||||
kMiscUseReflectionXform = 0x1000, // Use the calculated reflection environment
|
||||
// texture transform instead of layer->GetTransform()
|
||||
kMiscPerspProjection = 0x2000,
|
||||
kMiscOrthoProjection = 0x4000,
|
||||
kMiscProjection = kMiscPerspProjection | kMiscOrthoProjection,
|
||||
|
||||
kMiscRestartPassHere = 0x8000, // Tells pipeline to start a new pass beginning with this layer
|
||||
// Kinda like troubledLoner, but only cuts off lower layers, not
|
||||
// higher ones (kMiscBindNext sometimes does this by implication)
|
||||
|
||||
kMiscBumpLayer = 0x10000,
|
||||
kMiscBumpDu = 0x20000,
|
||||
kMiscBumpDv = 0x40000,
|
||||
kMiscBumpDw = 0x80000,
|
||||
kMiscBumpChans = kMiscBumpDu | kMiscBumpDv | kMiscBumpDw,
|
||||
|
||||
kMiscNoShadowAlpha = 0x100000,
|
||||
kMiscUseRefractionXform = 0x200000, // Use a refraction-like hack.
|
||||
kMiscCam2Screen = 0x400000, // Expects tex coords to be XYZ in camera space. Does a cam to screen (not NDC) projection
|
||||
// and swaps Z with W, so that the texture projection can produce projected 2D screen coordinates.
|
||||
|
||||
kAllMiscFlags = 0xffffffff
|
||||
};
|
||||
enum StateIdx {
|
||||
kBlend,
|
||||
kClamp,
|
||||
kShade,
|
||||
kZ,
|
||||
kMisc
|
||||
};
|
||||
UInt32 fBlendFlags;
|
||||
UInt32 fClampFlags;
|
||||
UInt32 fShadeFlags;
|
||||
UInt32 fZFlags;
|
||||
UInt32 fMiscFlags;
|
||||
|
||||
static hsBool Differs(UInt32 mine, UInt32 hers, UInt32 mask)
|
||||
{
|
||||
return (mine & mask) ^ (hers & mask);
|
||||
}
|
||||
|
||||
static hsBool Differs(UInt32 mine, UInt32 hers)
|
||||
{
|
||||
return mine ^ hers;
|
||||
}
|
||||
|
||||
hsBool operator!=(const hsGMatState& other)
|
||||
{
|
||||
return ((fBlendFlags ^ other.fBlendFlags)
|
||||
| (fClampFlags ^ other.fClampFlags)
|
||||
| (fShadeFlags ^ other.fShadeFlags)
|
||||
| (fZFlags ^ other.fZFlags)
|
||||
| (fMiscFlags ^ other.fMiscFlags));
|
||||
}
|
||||
UInt32 Value(int i) const
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case kBlend:
|
||||
return fBlendFlags;
|
||||
case kClamp:
|
||||
return fClampFlags;
|
||||
case kShade:
|
||||
return fShadeFlags;
|
||||
case kZ:
|
||||
return fZFlags;
|
||||
case kMisc:
|
||||
return fMiscFlags;
|
||||
}
|
||||
hsAssert(false, "Bad param");
|
||||
return fBlendFlags;
|
||||
}
|
||||
UInt32& operator[](const int i)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case kBlend:
|
||||
return fBlendFlags;
|
||||
case kClamp:
|
||||
return fClampFlags;
|
||||
case kShade:
|
||||
return fShadeFlags;
|
||||
case kZ:
|
||||
return fZFlags;
|
||||
case kMisc:
|
||||
return fMiscFlags;
|
||||
}
|
||||
hsAssert(false, "Bad param");
|
||||
return fBlendFlags;
|
||||
}
|
||||
hsGMatState& operator|=(const hsGMatState& other)
|
||||
{
|
||||
fBlendFlags |= other.fBlendFlags;
|
||||
fClampFlags |= other.fClampFlags;
|
||||
fShadeFlags |= other.fShadeFlags;
|
||||
fZFlags |= other.fZFlags;
|
||||
fMiscFlags |= other.fMiscFlags;
|
||||
return *this;
|
||||
}
|
||||
hsGMatState& operator+=(const hsGMatState& other)
|
||||
{
|
||||
return operator|=(other);
|
||||
}
|
||||
hsGMatState& operator-=(const hsGMatState& other)
|
||||
{
|
||||
fBlendFlags &= ~other.fBlendFlags;
|
||||
fClampFlags &= ~other.fClampFlags;
|
||||
fShadeFlags &= ~other.fShadeFlags;
|
||||
fZFlags &= ~other.fZFlags;
|
||||
fMiscFlags &= ~other.fMiscFlags;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Read(hsStream* s);
|
||||
inline void Write(hsStream* s);
|
||||
|
||||
hsGMatState(UInt32 blend=0, UInt32 clamp=0, UInt32 shade=0, UInt32 z=0, UInt32 misc=0)
|
||||
: fBlendFlags(blend),
|
||||
fClampFlags(clamp),
|
||||
fShadeFlags(shade),
|
||||
fZFlags(z),
|
||||
fMiscFlags(misc) {}
|
||||
void Reset() { fBlendFlags = fClampFlags = fShadeFlags = fZFlags = fMiscFlags = 0; }
|
||||
inline void Clear(const hsGMatState& state);
|
||||
inline void Composite(const hsGMatState& want, const hsGMatState& on, const hsGMatState& off);
|
||||
};
|
||||
|
||||
|
||||
#endif // hsGMatState_inc
|
||||
|
@ -1,53 +1,53 @@
|
||||
|
||||
#ifndef hsGMatStateInline_inc
|
||||
#define hsGMatStateInline_inc
|
||||
|
||||
#include "hsGMatState.h"
|
||||
#include "hsStream.h"
|
||||
|
||||
void hsGMatState::Read(hsStream* s)
|
||||
{
|
||||
fBlendFlags = s->ReadSwap32();
|
||||
fClampFlags = s->ReadSwap32();
|
||||
fShadeFlags = s->ReadSwap32();
|
||||
fZFlags = s->ReadSwap32();
|
||||
fMiscFlags = s->ReadSwap32();
|
||||
}
|
||||
|
||||
void hsGMatState::Write(hsStream* s)
|
||||
{
|
||||
s->WriteSwap32(fBlendFlags);
|
||||
s->WriteSwap32(fClampFlags);
|
||||
s->WriteSwap32(fShadeFlags);
|
||||
s->WriteSwap32(fZFlags);
|
||||
s->WriteSwap32(fMiscFlags);
|
||||
}
|
||||
|
||||
void hsGMatState::Clear(const hsGMatState& state)
|
||||
{
|
||||
fBlendFlags &= ~state.fBlendFlags;
|
||||
fClampFlags &= ~state.fClampFlags;
|
||||
fShadeFlags &= ~state.fShadeFlags;
|
||||
fZFlags &= ~state.fZFlags;
|
||||
fMiscFlags &= ~state.fMiscFlags;
|
||||
}
|
||||
|
||||
void hsGMatState::Composite(const hsGMatState& want, const hsGMatState& on, const hsGMatState& off)
|
||||
{
|
||||
fBlendFlags = want.fBlendFlags & ~off.fBlendFlags;
|
||||
if( !(fBlendFlags & (kBlendMask & ~(kBlendAlpha|kBlendAntiAlias))) )
|
||||
fBlendFlags |= on.fBlendFlags;
|
||||
|
||||
fClampFlags = (want.fClampFlags | on.fClampFlags) & ~off.fClampFlags;
|
||||
|
||||
fShadeFlags = (want.fShadeFlags | on.fShadeFlags) & ~off.fShadeFlags;
|
||||
#if 0 // This restriction is only valid for glide - handle in glideDevice
|
||||
if( fBlendFlags & (kBlendAntiAlias | kBlendAlpha) )
|
||||
fShadeFlags &= ~(kShadeSpecularAlpha | kShadeSpecularHighlight);
|
||||
#endif // This restriction is only valid for glide - handle in glideDevice
|
||||
|
||||
fZFlags = (want.fZFlags | on.fZFlags) & ~off.fZFlags;
|
||||
fMiscFlags = (want.fMiscFlags | on.fMiscFlags) & ~off.fMiscFlags;
|
||||
}
|
||||
|
||||
#endif // hsGMatStateInline_inc
|
||||
|
||||
#ifndef hsGMatStateInline_inc
|
||||
#define hsGMatStateInline_inc
|
||||
|
||||
#include "hsGMatState.h"
|
||||
#include "hsStream.h"
|
||||
|
||||
void hsGMatState::Read(hsStream* s)
|
||||
{
|
||||
fBlendFlags = s->ReadSwap32();
|
||||
fClampFlags = s->ReadSwap32();
|
||||
fShadeFlags = s->ReadSwap32();
|
||||
fZFlags = s->ReadSwap32();
|
||||
fMiscFlags = s->ReadSwap32();
|
||||
}
|
||||
|
||||
void hsGMatState::Write(hsStream* s)
|
||||
{
|
||||
s->WriteSwap32(fBlendFlags);
|
||||
s->WriteSwap32(fClampFlags);
|
||||
s->WriteSwap32(fShadeFlags);
|
||||
s->WriteSwap32(fZFlags);
|
||||
s->WriteSwap32(fMiscFlags);
|
||||
}
|
||||
|
||||
void hsGMatState::Clear(const hsGMatState& state)
|
||||
{
|
||||
fBlendFlags &= ~state.fBlendFlags;
|
||||
fClampFlags &= ~state.fClampFlags;
|
||||
fShadeFlags &= ~state.fShadeFlags;
|
||||
fZFlags &= ~state.fZFlags;
|
||||
fMiscFlags &= ~state.fMiscFlags;
|
||||
}
|
||||
|
||||
void hsGMatState::Composite(const hsGMatState& want, const hsGMatState& on, const hsGMatState& off)
|
||||
{
|
||||
fBlendFlags = want.fBlendFlags & ~off.fBlendFlags;
|
||||
if( !(fBlendFlags & (kBlendMask & ~(kBlendAlpha|kBlendAntiAlias))) )
|
||||
fBlendFlags |= on.fBlendFlags;
|
||||
|
||||
fClampFlags = (want.fClampFlags | on.fClampFlags) & ~off.fClampFlags;
|
||||
|
||||
fShadeFlags = (want.fShadeFlags | on.fShadeFlags) & ~off.fShadeFlags;
|
||||
#if 0 // This restriction is only valid for glide - handle in glideDevice
|
||||
if( fBlendFlags & (kBlendAntiAlias | kBlendAlpha) )
|
||||
fShadeFlags &= ~(kShadeSpecularAlpha | kShadeSpecularHighlight);
|
||||
#endif // This restriction is only valid for glide - handle in glideDevice
|
||||
|
||||
fZFlags = (want.fZFlags | on.fZFlags) & ~off.fZFlags;
|
||||
fMiscFlags = (want.fMiscFlags | on.fMiscFlags) & ~off.fMiscFlags;
|
||||
}
|
||||
|
||||
#endif // hsGMatStateInline_inc
|
||||
|
@ -1,141 +1,141 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsResMgr_inc
|
||||
#define hsResMgr_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsRefCnt.h"
|
||||
#include "plLoadMask.h"
|
||||
#include "plRefFlags.h"
|
||||
#include "pnKeyedObject/plKey.h"
|
||||
|
||||
class hsStream;
|
||||
class plKeyImp;
|
||||
class hsKeyedObject;
|
||||
class plRefMsg;
|
||||
class plUoid;
|
||||
class plLocation;
|
||||
class plCreatable;
|
||||
class plDispatchBase;
|
||||
|
||||
class hsResMgr : public hsRefCnt
|
||||
{
|
||||
public:
|
||||
//---------------------------
|
||||
// Load and Unload
|
||||
//---------------------------
|
||||
virtual void Load (const plKey& objKey)=0; // places on list to be loaded
|
||||
virtual hsBool Unload(const plKey& objKey)=0; // Unregisters (deletes) an object, Return true if successful
|
||||
virtual plKey CloneKey(const plKey& objKey)=0;
|
||||
|
||||
//---------------------------
|
||||
// Finding Functions
|
||||
//---------------------------
|
||||
virtual plKey FindKey(const plUoid& uoid)=0;
|
||||
|
||||
//---------------------------
|
||||
// Establish reference linkage
|
||||
//---------------------------
|
||||
virtual hsBool AddViaNotify(const plKey& sentKey, plRefMsg* msg, plRefFlags::Type flags)=0;
|
||||
virtual hsBool AddViaNotify(plRefMsg* msg, plRefFlags::Type flags)=0; // msg->fRef->GetKey() == sentKey
|
||||
|
||||
virtual hsBool SendRef(const plKey& key, plRefMsg* refMsg, plRefFlags::Type flags)=0;
|
||||
virtual hsBool SendRef(hsKeyedObject* ko, plRefMsg* refMsg, plRefFlags::Type flags)=0;
|
||||
|
||||
//---------------------------
|
||||
// Reading and Writing keys
|
||||
//---------------------------
|
||||
// Read a Key in, and Notify me when the Object is loaded
|
||||
virtual plKey ReadKeyNotifyMe(hsStream* s, plRefMsg* retMsg, plRefFlags::Type flags)=0;
|
||||
// Just read the Key data in and find a match in the registry and return it.
|
||||
virtual plKey ReadKey(hsStream* s)=0;
|
||||
|
||||
// For convenience you can write a key using the KeyedObject or the Key...same result
|
||||
virtual void WriteKey(hsStream* s, hsKeyedObject* obj)=0;
|
||||
virtual void WriteKey(hsStream* s, const plKey& key)=0;
|
||||
|
||||
//---------------------------
|
||||
// Reading and Writing Objects directly
|
||||
//---------------------------
|
||||
virtual plCreatable* ReadCreatable(hsStream* s)=0;
|
||||
virtual void WriteCreatable(hsStream* s, plCreatable* cre)=0;
|
||||
|
||||
virtual plCreatable* ReadCreatableVersion(hsStream* s)=0;
|
||||
virtual void WriteCreatableVersion(hsStream* s, plCreatable* cre)=0;
|
||||
|
||||
//---------------------------
|
||||
// Registry Modification Functions
|
||||
//---------------------------
|
||||
virtual plKey NewKey(const char* name, hsKeyedObject* object, const plLocation& loc, const plLoadMask& m = plLoadMask::kAlways)=0;
|
||||
virtual plKey NewKey(plUoid& newUoid, hsKeyedObject* object)=0;
|
||||
|
||||
virtual plDispatchBase* Dispatch()=0;
|
||||
|
||||
virtual void BeginShutdown() {}
|
||||
|
||||
protected:
|
||||
friend class hsKeyedObject;
|
||||
friend class plKey;
|
||||
friend class plKeyImp;
|
||||
friend class plArmatureMod; // Temp hack until a findkey/clone issue is fixed. -Bob
|
||||
|
||||
virtual plKey ReRegister(const char *nm, const plUoid& oid)=0;
|
||||
virtual hsBool ReadObject(plKeyImp* key)=0; // plKeys call this when needed
|
||||
|
||||
// Sets a key as used or unused in the registry. When all keys in a page of a
|
||||
// particular type in an page are unused, we can free the memory associated with them.
|
||||
// Only called by plKeyImp
|
||||
virtual void IKeyReffed(plKeyImp* key)=0;
|
||||
virtual void IKeyUnreffed(plKeyImp* key)=0;
|
||||
|
||||
protected: // hsgResMgr only
|
||||
friend class hsgResMgr;
|
||||
virtual hsBool IReset()=0;
|
||||
virtual hsBool IInit()=0;
|
||||
virtual void IShutdown()=0;
|
||||
};
|
||||
|
||||
|
||||
class hsgResMgr
|
||||
{
|
||||
private:
|
||||
static hsResMgr* fResMgr;
|
||||
|
||||
public:
|
||||
static hsResMgr* ResMgr() { return (hsResMgr*)fResMgr; }
|
||||
|
||||
static plDispatchBase* Dispatch() { hsAssert(fResMgr, "No resmgr"); return fResMgr->Dispatch(); }
|
||||
|
||||
static hsBool Init(hsResMgr* m);
|
||||
static hsBool Reset() { return fResMgr->IReset(); }
|
||||
static void Shutdown();
|
||||
|
||||
static hsBool SendRef(plKey& key, plRefMsg* refMsg, plRefFlags::Type flags) { return fResMgr->SendRef(key, refMsg, flags); }
|
||||
static hsBool SendRef(hsKeyedObject* ko, plRefMsg* refMsg, plRefFlags::Type flags) { return fResMgr->SendRef(ko, refMsg, flags); }
|
||||
};
|
||||
|
||||
#endif // hsResMgr_inc
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsResMgr_inc
|
||||
#define hsResMgr_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsRefCnt.h"
|
||||
#include "plLoadMask.h"
|
||||
#include "plRefFlags.h"
|
||||
#include "pnKeyedObject/plKey.h"
|
||||
|
||||
class hsStream;
|
||||
class plKeyImp;
|
||||
class hsKeyedObject;
|
||||
class plRefMsg;
|
||||
class plUoid;
|
||||
class plLocation;
|
||||
class plCreatable;
|
||||
class plDispatchBase;
|
||||
|
||||
class hsResMgr : public hsRefCnt
|
||||
{
|
||||
public:
|
||||
//---------------------------
|
||||
// Load and Unload
|
||||
//---------------------------
|
||||
virtual void Load (const plKey& objKey)=0; // places on list to be loaded
|
||||
virtual hsBool Unload(const plKey& objKey)=0; // Unregisters (deletes) an object, Return true if successful
|
||||
virtual plKey CloneKey(const plKey& objKey)=0;
|
||||
|
||||
//---------------------------
|
||||
// Finding Functions
|
||||
//---------------------------
|
||||
virtual plKey FindKey(const plUoid& uoid)=0;
|
||||
|
||||
//---------------------------
|
||||
// Establish reference linkage
|
||||
//---------------------------
|
||||
virtual hsBool AddViaNotify(const plKey& sentKey, plRefMsg* msg, plRefFlags::Type flags)=0;
|
||||
virtual hsBool AddViaNotify(plRefMsg* msg, plRefFlags::Type flags)=0; // msg->fRef->GetKey() == sentKey
|
||||
|
||||
virtual hsBool SendRef(const plKey& key, plRefMsg* refMsg, plRefFlags::Type flags)=0;
|
||||
virtual hsBool SendRef(hsKeyedObject* ko, plRefMsg* refMsg, plRefFlags::Type flags)=0;
|
||||
|
||||
//---------------------------
|
||||
// Reading and Writing keys
|
||||
//---------------------------
|
||||
// Read a Key in, and Notify me when the Object is loaded
|
||||
virtual plKey ReadKeyNotifyMe(hsStream* s, plRefMsg* retMsg, plRefFlags::Type flags)=0;
|
||||
// Just read the Key data in and find a match in the registry and return it.
|
||||
virtual plKey ReadKey(hsStream* s)=0;
|
||||
|
||||
// For convenience you can write a key using the KeyedObject or the Key...same result
|
||||
virtual void WriteKey(hsStream* s, hsKeyedObject* obj)=0;
|
||||
virtual void WriteKey(hsStream* s, const plKey& key)=0;
|
||||
|
||||
//---------------------------
|
||||
// Reading and Writing Objects directly
|
||||
//---------------------------
|
||||
virtual plCreatable* ReadCreatable(hsStream* s)=0;
|
||||
virtual void WriteCreatable(hsStream* s, plCreatable* cre)=0;
|
||||
|
||||
virtual plCreatable* ReadCreatableVersion(hsStream* s)=0;
|
||||
virtual void WriteCreatableVersion(hsStream* s, plCreatable* cre)=0;
|
||||
|
||||
//---------------------------
|
||||
// Registry Modification Functions
|
||||
//---------------------------
|
||||
virtual plKey NewKey(const char* name, hsKeyedObject* object, const plLocation& loc, const plLoadMask& m = plLoadMask::kAlways)=0;
|
||||
virtual plKey NewKey(plUoid& newUoid, hsKeyedObject* object)=0;
|
||||
|
||||
virtual plDispatchBase* Dispatch()=0;
|
||||
|
||||
virtual void BeginShutdown() {}
|
||||
|
||||
protected:
|
||||
friend class hsKeyedObject;
|
||||
friend class plKey;
|
||||
friend class plKeyImp;
|
||||
friend class plArmatureMod; // Temp hack until a findkey/clone issue is fixed. -Bob
|
||||
|
||||
virtual plKey ReRegister(const char *nm, const plUoid& oid)=0;
|
||||
virtual hsBool ReadObject(plKeyImp* key)=0; // plKeys call this when needed
|
||||
|
||||
// Sets a key as used or unused in the registry. When all keys in a page of a
|
||||
// particular type in an page are unused, we can free the memory associated with them.
|
||||
// Only called by plKeyImp
|
||||
virtual void IKeyReffed(plKeyImp* key)=0;
|
||||
virtual void IKeyUnreffed(plKeyImp* key)=0;
|
||||
|
||||
protected: // hsgResMgr only
|
||||
friend class hsgResMgr;
|
||||
virtual hsBool IReset()=0;
|
||||
virtual hsBool IInit()=0;
|
||||
virtual void IShutdown()=0;
|
||||
};
|
||||
|
||||
|
||||
class hsgResMgr
|
||||
{
|
||||
private:
|
||||
static hsResMgr* fResMgr;
|
||||
|
||||
public:
|
||||
static hsResMgr* ResMgr() { return (hsResMgr*)fResMgr; }
|
||||
|
||||
static plDispatchBase* Dispatch() { hsAssert(fResMgr, "No resmgr"); return fResMgr->Dispatch(); }
|
||||
|
||||
static hsBool Init(hsResMgr* m);
|
||||
static hsBool Reset() { return fResMgr->IReset(); }
|
||||
static void Shutdown();
|
||||
|
||||
static hsBool SendRef(plKey& key, plRefMsg* refMsg, plRefFlags::Type flags) { return fResMgr->SendRef(key, refMsg, flags); }
|
||||
static hsBool SendRef(hsKeyedObject* ko, plRefMsg* refMsg, plRefFlags::Type flags) { return fResMgr->SendRef(ko, refMsg, flags); }
|
||||
};
|
||||
|
||||
#endif // hsResMgr_inc
|
||||
|
||||
|
@ -1,156 +1,156 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsTimer_Defined
|
||||
#define hsTimer_Defined
|
||||
|
||||
#include "hsWide.h"
|
||||
#include "hsScalar.h"
|
||||
|
||||
#if !HS_CAN_USE_FLOAT
|
||||
#error "Unsupported without double's"
|
||||
#endif // !HS_CAN_USE_FLOAT
|
||||
|
||||
class plTimerShare
|
||||
{
|
||||
protected:
|
||||
mutable hsBool fFirstTime;
|
||||
mutable hsWide fRawTimeZero;
|
||||
mutable hsBool fResetSmooth;
|
||||
|
||||
enum {
|
||||
kSmoothBuffLen = 10
|
||||
};
|
||||
double fSmoothBuff[kSmoothBuffLen];
|
||||
int fCurrSlot;
|
||||
|
||||
hsScalar fSysTimeScale;
|
||||
double fRealSeconds;
|
||||
double fSysSeconds;
|
||||
hsScalar fDelSysSeconds;
|
||||
hsScalar fFrameTimeInc;
|
||||
hsBool fRunningFrameTime;
|
||||
hsScalar fTimeClampSecs;
|
||||
hsScalar fSmoothingClampSecs;
|
||||
hsBool fClamping;
|
||||
|
||||
hsWide* FactorInTimeZero(hsWide* ticks) const;
|
||||
|
||||
double GetSeconds() const;
|
||||
double GetMilliSeconds() const;
|
||||
|
||||
hsWide* GetRawTicks(hsWide* ticks) const;
|
||||
|
||||
double RawTicksToDSeconds(const hsWide& ticks);
|
||||
hsWide DSecondsToRawTicks(double secs);
|
||||
|
||||
hsScalar GetDelSysSeconds() const { return fDelSysSeconds; }
|
||||
double GetSysSeconds() const { return fSysSeconds; }
|
||||
double IncSysSeconds();
|
||||
|
||||
void SetRealTime(hsBool realTime);
|
||||
hsBool IsRealTime() const { return !fRunningFrameTime; }
|
||||
|
||||
void SetFrameTimeInc(hsScalar inc) { fFrameTimeInc = inc; }
|
||||
|
||||
void SetTimeScale(hsScalar s) { fSysTimeScale = s; }
|
||||
hsScalar GetTimeScale() const { return fSysTimeScale; }
|
||||
|
||||
void SetTimeClamp(hsScalar secs) { fTimeClampSecs = secs; }
|
||||
void SetSmoothingCap(hsScalar secs) { fSmoothingClampSecs = secs; }
|
||||
hsScalar GetTimeClamp() const { return fTimeClampSecs; }
|
||||
hsBool IsClamping() const { return fClamping; }
|
||||
|
||||
friend class hsTimer;
|
||||
public:
|
||||
plTimerShare();
|
||||
~plTimerShare();
|
||||
};
|
||||
|
||||
class hsTimer
|
||||
{
|
||||
protected:
|
||||
static const double fPrecTicksPerSec;
|
||||
static const hsWide fRawBase;
|
||||
|
||||
static hsWide IInitRawBase();
|
||||
|
||||
static plTimerShare* fTimer;
|
||||
public:
|
||||
|
||||
static hsBool VerifyRawBase() { return fRawBase == IInitRawBase(); }
|
||||
static const hsWide& GetRawBase() { return fRawBase; }
|
||||
|
||||
static hsWide* GetRawTicks(hsWide* ticks) { return fTimer->GetRawTicks(ticks); }
|
||||
|
||||
static double GetSeconds() { return fTimer->GetSeconds(); }
|
||||
static double GetMilliSeconds() { return fTimer->GetMilliSeconds(); }
|
||||
|
||||
static double RawTicksToDSeconds(const hsWide& ticks) { return fTimer->RawTicksToDSeconds(ticks); }
|
||||
static hsWide DSecondsToRawTicks(double secs) { return fTimer->DSecondsToRawTicks(secs); }
|
||||
|
||||
static hsScalar GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); }
|
||||
static double GetSysSeconds() { return fTimer->GetSysSeconds(); }
|
||||
|
||||
static double IncSysSeconds() { return fTimer->IncSysSeconds(); }
|
||||
|
||||
static void SetRealTime(hsBool realTime) { fTimer->SetRealTime(realTime); }
|
||||
static hsBool IsRealTime() { return fTimer->IsRealTime(); }
|
||||
|
||||
static void SetFrameTimeInc(hsScalar inc) { fTimer->SetFrameTimeInc(inc); }
|
||||
|
||||
static void SetTimeScale(hsScalar s) { fTimer->SetTimeScale(s); }
|
||||
static hsScalar GetTimeScale() { return fTimer->GetTimeScale(); }
|
||||
|
||||
static void SetTimeClamp(hsScalar secs) { fTimer->SetTimeClamp(secs); }
|
||||
static void SetTimeSmoothingClamp(hsScalar secs) { fTimer->SetSmoothingCap(secs); }
|
||||
static hsScalar GetTimeClamp() { return fTimer->GetTimeClamp(); }
|
||||
static hsBool IsClamping() { return fTimer->IsClamping(); }
|
||||
|
||||
///////////////////////////
|
||||
// Precision timer routines - these are stateless and implemented as statics.
|
||||
///////////////////////////
|
||||
static UInt32 GetPrecTickCount();
|
||||
static double GetPrecTicksPerSec();
|
||||
static UInt32 PrecSecsToTicks(hsScalar secs);
|
||||
static double PrecTicksToSecs(UInt32 ticks);
|
||||
static double PrecTicksToHz(UInt32 ticks);
|
||||
|
||||
// If you need to time something longer than 20 seconds, use this instead of
|
||||
// the precision timer. It works the same, it just gives you full resolution.
|
||||
static UInt64 GetFullTickCount();
|
||||
static float FullTicksToMs(UInt64 ticks);
|
||||
|
||||
//
|
||||
// Pass GetTheTimer() into other process space, and then call SetTheTimer() on it.
|
||||
static void SetTheTimer(plTimerShare* timer);
|
||||
static plTimerShare* GetTheTimer() { return fTimer; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef hsTimer_Defined
|
||||
#define hsTimer_Defined
|
||||
|
||||
#include "hsWide.h"
|
||||
#include "hsScalar.h"
|
||||
|
||||
#if !HS_CAN_USE_FLOAT
|
||||
#error "Unsupported without double's"
|
||||
#endif // !HS_CAN_USE_FLOAT
|
||||
|
||||
class plTimerShare
|
||||
{
|
||||
protected:
|
||||
mutable hsBool fFirstTime;
|
||||
mutable hsWide fRawTimeZero;
|
||||
mutable hsBool fResetSmooth;
|
||||
|
||||
enum {
|
||||
kSmoothBuffLen = 10
|
||||
};
|
||||
double fSmoothBuff[kSmoothBuffLen];
|
||||
int fCurrSlot;
|
||||
|
||||
hsScalar fSysTimeScale;
|
||||
double fRealSeconds;
|
||||
double fSysSeconds;
|
||||
hsScalar fDelSysSeconds;
|
||||
hsScalar fFrameTimeInc;
|
||||
hsBool fRunningFrameTime;
|
||||
hsScalar fTimeClampSecs;
|
||||
hsScalar fSmoothingClampSecs;
|
||||
hsBool fClamping;
|
||||
|
||||
hsWide* FactorInTimeZero(hsWide* ticks) const;
|
||||
|
||||
double GetSeconds() const;
|
||||
double GetMilliSeconds() const;
|
||||
|
||||
hsWide* GetRawTicks(hsWide* ticks) const;
|
||||
|
||||
double RawTicksToDSeconds(const hsWide& ticks);
|
||||
hsWide DSecondsToRawTicks(double secs);
|
||||
|
||||
hsScalar GetDelSysSeconds() const { return fDelSysSeconds; }
|
||||
double GetSysSeconds() const { return fSysSeconds; }
|
||||
double IncSysSeconds();
|
||||
|
||||
void SetRealTime(hsBool realTime);
|
||||
hsBool IsRealTime() const { return !fRunningFrameTime; }
|
||||
|
||||
void SetFrameTimeInc(hsScalar inc) { fFrameTimeInc = inc; }
|
||||
|
||||
void SetTimeScale(hsScalar s) { fSysTimeScale = s; }
|
||||
hsScalar GetTimeScale() const { return fSysTimeScale; }
|
||||
|
||||
void SetTimeClamp(hsScalar secs) { fTimeClampSecs = secs; }
|
||||
void SetSmoothingCap(hsScalar secs) { fSmoothingClampSecs = secs; }
|
||||
hsScalar GetTimeClamp() const { return fTimeClampSecs; }
|
||||
hsBool IsClamping() const { return fClamping; }
|
||||
|
||||
friend class hsTimer;
|
||||
public:
|
||||
plTimerShare();
|
||||
~plTimerShare();
|
||||
};
|
||||
|
||||
class hsTimer
|
||||
{
|
||||
protected:
|
||||
static const double fPrecTicksPerSec;
|
||||
static const hsWide fRawBase;
|
||||
|
||||
static hsWide IInitRawBase();
|
||||
|
||||
static plTimerShare* fTimer;
|
||||
public:
|
||||
|
||||
static hsBool VerifyRawBase() { return fRawBase == IInitRawBase(); }
|
||||
static const hsWide& GetRawBase() { return fRawBase; }
|
||||
|
||||
static hsWide* GetRawTicks(hsWide* ticks) { return fTimer->GetRawTicks(ticks); }
|
||||
|
||||
static double GetSeconds() { return fTimer->GetSeconds(); }
|
||||
static double GetMilliSeconds() { return fTimer->GetMilliSeconds(); }
|
||||
|
||||
static double RawTicksToDSeconds(const hsWide& ticks) { return fTimer->RawTicksToDSeconds(ticks); }
|
||||
static hsWide DSecondsToRawTicks(double secs) { return fTimer->DSecondsToRawTicks(secs); }
|
||||
|
||||
static hsScalar GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); }
|
||||
static double GetSysSeconds() { return fTimer->GetSysSeconds(); }
|
||||
|
||||
static double IncSysSeconds() { return fTimer->IncSysSeconds(); }
|
||||
|
||||
static void SetRealTime(hsBool realTime) { fTimer->SetRealTime(realTime); }
|
||||
static hsBool IsRealTime() { return fTimer->IsRealTime(); }
|
||||
|
||||
static void SetFrameTimeInc(hsScalar inc) { fTimer->SetFrameTimeInc(inc); }
|
||||
|
||||
static void SetTimeScale(hsScalar s) { fTimer->SetTimeScale(s); }
|
||||
static hsScalar GetTimeScale() { return fTimer->GetTimeScale(); }
|
||||
|
||||
static void SetTimeClamp(hsScalar secs) { fTimer->SetTimeClamp(secs); }
|
||||
static void SetTimeSmoothingClamp(hsScalar secs) { fTimer->SetSmoothingCap(secs); }
|
||||
static hsScalar GetTimeClamp() { return fTimer->GetTimeClamp(); }
|
||||
static hsBool IsClamping() { return fTimer->IsClamping(); }
|
||||
|
||||
///////////////////////////
|
||||
// Precision timer routines - these are stateless and implemented as statics.
|
||||
///////////////////////////
|
||||
static UInt32 GetPrecTickCount();
|
||||
static double GetPrecTicksPerSec();
|
||||
static UInt32 PrecSecsToTicks(hsScalar secs);
|
||||
static double PrecTicksToSecs(UInt32 ticks);
|
||||
static double PrecTicksToHz(UInt32 ticks);
|
||||
|
||||
// If you need to time something longer than 20 seconds, use this instead of
|
||||
// the precision timer. It works the same, it just gives you full resolution.
|
||||
static UInt64 GetFullTickCount();
|
||||
static float FullTicksToMs(UInt64 ticks);
|
||||
|
||||
//
|
||||
// Pass GetTheTimer() into other process space, and then call SetTheTimer() on it.
|
||||
static void SetTheTimer(plTimerShare* timer);
|
||||
static plTimerShare* GetTheTimer() { return fTimer; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,102 +1,102 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plAudible_inc
|
||||
#define plAudible_inc
|
||||
|
||||
#include "hsTemplates.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plSound;
|
||||
class hsStream;
|
||||
class hsResMgr;
|
||||
struct hsMatrix44;
|
||||
struct hsVector3;
|
||||
struct hsPoint3;
|
||||
class hsBounds3Ext;
|
||||
class plSoundMsg;
|
||||
class plEventCallbackMsg;
|
||||
|
||||
class plAudible : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plAudible );
|
||||
GETINTERFACE_ANY( plAudible, hsKeyedObject );
|
||||
|
||||
virtual plAudible& SetProperty(int prop, hsBool on) = 0;
|
||||
virtual hsBool GetProperty(int prop) = 0;
|
||||
|
||||
virtual plAudible& SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, int index = -1) { return *this; }
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr){hsKeyedObject::Read(s, mgr);}
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr){hsKeyedObject::Write(s, mgr);}
|
||||
|
||||
virtual void SetSceneObject(plKey obj) = 0;
|
||||
virtual plKey GetSceneObject() const = 0;
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
virtual void Play(int index = -1) = 0;
|
||||
virtual void SynchedPlay(int index = -1) = 0;
|
||||
virtual void Stop(int index = -1) = 0;
|
||||
virtual void FastForwardPlay(int index = -1) = 0;
|
||||
virtual void FastForwardToggle( int index = -1) = 0;
|
||||
virtual void SetMin(const hsScalar m,int index = -1) = 0; // sets minimum falloff distance
|
||||
virtual void SetMax(const hsScalar m,int index = -1) = 0; // sets maximum falloff distance
|
||||
virtual hsScalar GetMin(int index = -1) const = 0;
|
||||
virtual hsScalar GetMax(int index = -1) const = 0;
|
||||
virtual void SetVelocity(const hsVector3 vel,int index = -1) = 0;
|
||||
virtual hsVector3 GetVelocity(int index = -1) const = 0;
|
||||
virtual hsPoint3 GetPosition(int index = -1) = 0;
|
||||
virtual void SetLooping(hsBool loop,int index = -1) = 0; // sets continuous loop or stops looping
|
||||
virtual hsBool IsPlaying(int index = -1) = 0;
|
||||
virtual void SetTime(double t, int index = -1) = 0;
|
||||
virtual void Activate() = 0;
|
||||
virtual void DeActivate() = 0;
|
||||
virtual void RemoveCallbacks(plSoundMsg* pMsg) = 0;
|
||||
virtual void AddCallbacks(plSoundMsg* pMsg) = 0;
|
||||
virtual void GetStatus(plSoundMsg* pMsg) = 0;
|
||||
virtual int GetNumSounds() const = 0;
|
||||
virtual plSound* GetSound(int i) const = 0;
|
||||
virtual int GetSoundIndex(const char *keyname) const = 0;
|
||||
virtual void Init(hsBool isLocal){;}
|
||||
virtual void SetVolume(const float volume,int index = -1) = 0;
|
||||
virtual void SetMuted( hsBool muted, int index = -1 ) = 0;
|
||||
virtual void ToggleMuted( int index = -1 ) = 0;
|
||||
virtual void SetTalkIcon(int index, UInt32 str) = 0;
|
||||
virtual void ClearTalkIcon() = 0;
|
||||
virtual void SetFilename(int index, const char *filename, hsBool isCompressed) = 0; // set filename for a streaming sound
|
||||
virtual void SetFadeIn( const int type, const float length, int index = -1 ) = 0;
|
||||
virtual void SetFadeOut( const int type, const float length, int index = -1 ) = 0;
|
||||
|
||||
protected:
|
||||
hsTArray<plEventCallbackMsg*> fCallbacks;
|
||||
};
|
||||
|
||||
#endif // plAudible_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plAudible_inc
|
||||
#define plAudible_inc
|
||||
|
||||
#include "hsTemplates.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plSound;
|
||||
class hsStream;
|
||||
class hsResMgr;
|
||||
struct hsMatrix44;
|
||||
struct hsVector3;
|
||||
struct hsPoint3;
|
||||
class hsBounds3Ext;
|
||||
class plSoundMsg;
|
||||
class plEventCallbackMsg;
|
||||
|
||||
class plAudible : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plAudible );
|
||||
GETINTERFACE_ANY( plAudible, hsKeyedObject );
|
||||
|
||||
virtual plAudible& SetProperty(int prop, hsBool on) = 0;
|
||||
virtual hsBool GetProperty(int prop) = 0;
|
||||
|
||||
virtual plAudible& SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, int index = -1) { return *this; }
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr){hsKeyedObject::Read(s, mgr);}
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr){hsKeyedObject::Write(s, mgr);}
|
||||
|
||||
virtual void SetSceneObject(plKey obj) = 0;
|
||||
virtual plKey GetSceneObject() const = 0;
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
virtual void Play(int index = -1) = 0;
|
||||
virtual void SynchedPlay(int index = -1) = 0;
|
||||
virtual void Stop(int index = -1) = 0;
|
||||
virtual void FastForwardPlay(int index = -1) = 0;
|
||||
virtual void FastForwardToggle( int index = -1) = 0;
|
||||
virtual void SetMin(const hsScalar m,int index = -1) = 0; // sets minimum falloff distance
|
||||
virtual void SetMax(const hsScalar m,int index = -1) = 0; // sets maximum falloff distance
|
||||
virtual hsScalar GetMin(int index = -1) const = 0;
|
||||
virtual hsScalar GetMax(int index = -1) const = 0;
|
||||
virtual void SetVelocity(const hsVector3 vel,int index = -1) = 0;
|
||||
virtual hsVector3 GetVelocity(int index = -1) const = 0;
|
||||
virtual hsPoint3 GetPosition(int index = -1) = 0;
|
||||
virtual void SetLooping(hsBool loop,int index = -1) = 0; // sets continuous loop or stops looping
|
||||
virtual hsBool IsPlaying(int index = -1) = 0;
|
||||
virtual void SetTime(double t, int index = -1) = 0;
|
||||
virtual void Activate() = 0;
|
||||
virtual void DeActivate() = 0;
|
||||
virtual void RemoveCallbacks(plSoundMsg* pMsg) = 0;
|
||||
virtual void AddCallbacks(plSoundMsg* pMsg) = 0;
|
||||
virtual void GetStatus(plSoundMsg* pMsg) = 0;
|
||||
virtual int GetNumSounds() const = 0;
|
||||
virtual plSound* GetSound(int i) const = 0;
|
||||
virtual int GetSoundIndex(const char *keyname) const = 0;
|
||||
virtual void Init(hsBool isLocal){;}
|
||||
virtual void SetVolume(const float volume,int index = -1) = 0;
|
||||
virtual void SetMuted( hsBool muted, int index = -1 ) = 0;
|
||||
virtual void ToggleMuted( int index = -1 ) = 0;
|
||||
virtual void SetTalkIcon(int index, UInt32 str) = 0;
|
||||
virtual void ClearTalkIcon() = 0;
|
||||
virtual void SetFilename(int index, const char *filename, hsBool isCompressed) = 0; // set filename for a streaming sound
|
||||
virtual void SetFadeIn( const int type, const float length, int index = -1 ) = 0;
|
||||
virtual void SetFadeOut( const int type, const float length, int index = -1 ) = 0;
|
||||
|
||||
protected:
|
||||
hsTArray<plEventCallbackMsg*> fCallbacks;
|
||||
};
|
||||
|
||||
#endif // plAudible_inc
|
||||
|
@ -1,44 +1,44 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plCCRMgrBase_inc
|
||||
#define plCCRMgrBase_inc
|
||||
|
||||
//
|
||||
// Abstract base class for CCR Mgr
|
||||
//
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plCCRMgrBase : public hsKeyedObject
|
||||
{
|
||||
protected:
|
||||
static plCCRMgrBase* fBaseInstance;
|
||||
public:
|
||||
static plCCRMgrBase* GetInstance() { return fBaseInstance; }
|
||||
};
|
||||
|
||||
|
||||
#endif // plCCRMgrBase_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plCCRMgrBase_inc
|
||||
#define plCCRMgrBase_inc
|
||||
|
||||
//
|
||||
// Abstract base class for CCR Mgr
|
||||
//
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
class plCCRMgrBase : public hsKeyedObject
|
||||
{
|
||||
protected:
|
||||
static plCCRMgrBase* fBaseInstance;
|
||||
public:
|
||||
static plCCRMgrBase* GetInstance() { return fBaseInstance; }
|
||||
};
|
||||
|
||||
|
||||
#endif // plCCRMgrBase_inc
|
@ -1,58 +1,58 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plClassIndexMacros_inc
|
||||
#define plClassIndexMacros_inc
|
||||
|
||||
|
||||
// Macros for deriving the class index enum from the class name.
|
||||
// These should always be used in place of 'plFooIDX'.
|
||||
// Place before includes to avoid recursive include prob.
|
||||
// --For use within plCreatableIndex
|
||||
#define CLASS_INDEX(plClassName) plClassName##IDX
|
||||
// --For use within plExternalCreatableIndex
|
||||
#define EXTERN_CLASS_INDEX(plClassName) plClassName##IDX
|
||||
// --For use outside of plCreatableIndex
|
||||
#define CLASS_INDEX_SCOPED(plClassName) plCreatableIndex::CLASS_INDEX(plClassName)
|
||||
// --For use outside of plExternalCreatableIndex
|
||||
#define EXTERN_CLASS_INDEX_SCOPED(plClassName) plExternalCreatableIndex::EXTERN_CLASS_INDEX(plClassName)
|
||||
|
||||
// Macros for the start and end of the class index list
|
||||
#define CLASS_INDEX_LIST_START const int KEYED_OBJ_DELINEATOR = 512; \
|
||||
const int EXTERNAL_KEYED_DLL_BEGIN = 256; \
|
||||
const int EXTERNAL_KEYED_DLL_END = 511; \
|
||||
const int EXTERNAL_NONKEYED_DLL_BEGIN = 1436; \
|
||||
const int EXTERNAL_NONKEYED_DLL_END = 1536; \
|
||||
class plCreatableIndex { public: enum {
|
||||
#define CLASS_INDEX_LIST_END plNumClassIndices = EXTERNAL_NONKEYED_DLL_END + 1, }; };
|
||||
// Macro to mark which class index is the start of the nonkeyed object section
|
||||
#define CLASS_INDEX_NONKEYED_OBJ_START kKeyedObjDelineator = KEYED_OBJ_DELINEATOR-1,
|
||||
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START kDatabaseStructIndexesStart,
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END kDatabaseStructIndexesEnd=kDatabaseStructIndexesStart+100,
|
||||
|
||||
|
||||
#endif // plClassIndexMacros_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plClassIndexMacros_inc
|
||||
#define plClassIndexMacros_inc
|
||||
|
||||
|
||||
// Macros for deriving the class index enum from the class name.
|
||||
// These should always be used in place of 'plFooIDX'.
|
||||
// Place before includes to avoid recursive include prob.
|
||||
// --For use within plCreatableIndex
|
||||
#define CLASS_INDEX(plClassName) plClassName##IDX
|
||||
// --For use within plExternalCreatableIndex
|
||||
#define EXTERN_CLASS_INDEX(plClassName) plClassName##IDX
|
||||
// --For use outside of plCreatableIndex
|
||||
#define CLASS_INDEX_SCOPED(plClassName) plCreatableIndex::CLASS_INDEX(plClassName)
|
||||
// --For use outside of plExternalCreatableIndex
|
||||
#define EXTERN_CLASS_INDEX_SCOPED(plClassName) plExternalCreatableIndex::EXTERN_CLASS_INDEX(plClassName)
|
||||
|
||||
// Macros for the start and end of the class index list
|
||||
#define CLASS_INDEX_LIST_START const int KEYED_OBJ_DELINEATOR = 512; \
|
||||
const int EXTERNAL_KEYED_DLL_BEGIN = 256; \
|
||||
const int EXTERNAL_KEYED_DLL_END = 511; \
|
||||
const int EXTERNAL_NONKEYED_DLL_BEGIN = 1436; \
|
||||
const int EXTERNAL_NONKEYED_DLL_END = 1536; \
|
||||
class plCreatableIndex { public: enum {
|
||||
#define CLASS_INDEX_LIST_END plNumClassIndices = EXTERNAL_NONKEYED_DLL_END + 1, }; };
|
||||
// Macro to mark which class index is the start of the nonkeyed object section
|
||||
#define CLASS_INDEX_NONKEYED_OBJ_START kKeyedObjDelineator = KEYED_OBJ_DELINEATOR-1,
|
||||
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START kDatabaseStructIndexesStart,
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END kDatabaseStructIndexesEnd=kDatabaseStructIndexesStart+100,
|
||||
|
||||
|
||||
#endif // plClassIndexMacros_inc
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +1,78 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// plCreatableStrings.h - Handy header file that declares a class with two
|
||||
// static public string arrays representing the names
|
||||
// of the classes before and after keyedObjDelineator
|
||||
// in plCreatableIndex.h. Note the cunning (and humble)
|
||||
// use of macros to avoid having to change this file
|
||||
// whenever plCreatableIndex.h changes.
|
||||
//
|
||||
// Should only be included once, probably in plFactory.cpp
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _plCreatableStrings_h
|
||||
#define _plCreatableStrings_h
|
||||
|
||||
// Step 0: Undefine plCreatableIndex_inc, since we're doing something sneaky with it
|
||||
|
||||
#undef plCreatableIndex_inc
|
||||
|
||||
|
||||
// Step 1: Define plCreator_inc, so the plCreator.h include in plCI.h won't do anything
|
||||
|
||||
#define plCreator_inc
|
||||
|
||||
|
||||
// Step 2: Define the CLASS_INDEX macros so we generate our class. The class name
|
||||
// is plCreatableStrings and the arrays are fKeyedStrings and fNonKeyedStrings
|
||||
|
||||
#undef CLASS_INDEX_LIST_START
|
||||
#undef CLASS_INDEX
|
||||
#undef CLASS_INDEX_NONKEYED_OBJ_START
|
||||
#undef CLASS_INDEX_LIST_END
|
||||
|
||||
#define CLASS_INDEX_LIST_START class plCreatableStrings { public:\
|
||||
static char *fKeyedStrings[]; static char *fNonKeyedStrings[]; static char *fNonKeyedPostDBStrings[];\
|
||||
}; \
|
||||
char *plCreatableStrings::fKeyedStrings[] = {
|
||||
#define CLASS_INDEX(ci) #ci
|
||||
#define CLASS_INDEX_NONKEYED_OBJ_START }; char *plCreatableStrings::fNonKeyedStrings[] = {
|
||||
#define CLASS_INDEX_LIST_END };
|
||||
|
||||
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
|
||||
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_END
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END }; char *plCreatableStrings::fNonKeyedPostDBStrings[] = {
|
||||
|
||||
// Step 3: Include plCI.h
|
||||
|
||||
#include "plCreatableIndex.h"
|
||||
|
||||
|
||||
#endif // _plCreatableStrings_h
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// plCreatableStrings.h - Handy header file that declares a class with two
|
||||
// static public string arrays representing the names
|
||||
// of the classes before and after keyedObjDelineator
|
||||
// in plCreatableIndex.h. Note the cunning (and humble)
|
||||
// use of macros to avoid having to change this file
|
||||
// whenever plCreatableIndex.h changes.
|
||||
//
|
||||
// Should only be included once, probably in plFactory.cpp
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _plCreatableStrings_h
|
||||
#define _plCreatableStrings_h
|
||||
|
||||
// Step 0: Undefine plCreatableIndex_inc, since we're doing something sneaky with it
|
||||
|
||||
#undef plCreatableIndex_inc
|
||||
|
||||
|
||||
// Step 1: Define plCreator_inc, so the plCreator.h include in plCI.h won't do anything
|
||||
|
||||
#define plCreator_inc
|
||||
|
||||
|
||||
// Step 2: Define the CLASS_INDEX macros so we generate our class. The class name
|
||||
// is plCreatableStrings and the arrays are fKeyedStrings and fNonKeyedStrings
|
||||
|
||||
#undef CLASS_INDEX_LIST_START
|
||||
#undef CLASS_INDEX
|
||||
#undef CLASS_INDEX_NONKEYED_OBJ_START
|
||||
#undef CLASS_INDEX_LIST_END
|
||||
|
||||
#define CLASS_INDEX_LIST_START class plCreatableStrings { public:\
|
||||
static char *fKeyedStrings[]; static char *fNonKeyedStrings[]; static char *fNonKeyedPostDBStrings[];\
|
||||
}; \
|
||||
char *plCreatableStrings::fKeyedStrings[] = {
|
||||
#define CLASS_INDEX(ci) #ci
|
||||
#define CLASS_INDEX_NONKEYED_OBJ_START }; char *plCreatableStrings::fNonKeyedStrings[] = {
|
||||
#define CLASS_INDEX_LIST_END };
|
||||
|
||||
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
|
||||
#undef CLASS_INDEX_DATABASE_STRUCT_INDEXES_END
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_START
|
||||
#define CLASS_INDEX_DATABASE_STRUCT_INDEXES_END }; char *plCreatableStrings::fNonKeyedPostDBStrings[] = {
|
||||
|
||||
// Step 3: Include plCI.h
|
||||
|
||||
#include "plCreatableIndex.h"
|
||||
|
||||
|
||||
#endif // _plCreatableStrings_h
|
||||
|
@ -1,186 +1,186 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plDrawable_inc
|
||||
#define plDrawable_inc
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "plLoadMask.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "plRenderLevel.h"
|
||||
|
||||
class plSpaceTree;
|
||||
class hsStream;
|
||||
class hsResMgr;
|
||||
struct hsMatrix44;
|
||||
class hsBounds3Ext;
|
||||
class plPipeline;
|
||||
class plGeometrySpan;
|
||||
class hsGMaterial;
|
||||
class plParticleEmitter;
|
||||
class plAccessSpan;
|
||||
|
||||
class plDrawableCriteria
|
||||
{
|
||||
public:
|
||||
plDrawableCriteria(UInt32 crit, const plRenderLevel& lev, const plLoadMask& m, UInt32 ty=1 /* Normal */ ) : fCriteria(crit), fLevel(lev), fType(ty), fLoadMask(m) {}
|
||||
UInt32 fCriteria;
|
||||
plRenderLevel fLevel;
|
||||
UInt32 fType;
|
||||
plLoadMask fLoadMask;
|
||||
};
|
||||
|
||||
class plDrawable : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
// Renumber these the next time we bump major version #s (no reason to do it now)
|
||||
kPropNoDraw = 0x01,
|
||||
kPropUNUSED = 0x02,
|
||||
kPropSortSpans = 0x04,
|
||||
kPropSortFaces = 0x08,
|
||||
kPropVolatile = 0x10, // Means that spans DEFAULT to kPropVolatile, but if this
|
||||
// is not set, spans can still be volatile
|
||||
kPropNoReSort = 0x20, // Don't do sorting of spans for optimization.
|
||||
kPropPartialSort = 0x40, // Sort spans on an individual basis.
|
||||
kPropCharacter = 0x80, // Lights want to know if this is in the general class of "characters"
|
||||
kPropSortAsOne = 0x100,
|
||||
kPropHasVisLOS = 0x200
|
||||
};
|
||||
|
||||
// Criteria for drawables. Used when searching through a sceneNode for a particular drawable
|
||||
enum
|
||||
{
|
||||
kCritStatic = 0x01,
|
||||
kCritSortSpans = 0x02,
|
||||
kCritSortFaces = 0x08,
|
||||
kCritCharacter = 0x10
|
||||
};
|
||||
// Types of drawables for rendering filtering.
|
||||
enum plDrawableType {
|
||||
kNormal = 0x00000001,
|
||||
kNonDrawable = 0x00000002, //e.g. a light, affects drawing, but isn't drawn.
|
||||
kEnviron = 0x00000004,
|
||||
|
||||
// Proxies in the upper 16 bits.
|
||||
kLightProxy = 0x00010000,
|
||||
kOccluderProxy = 0x00020000,
|
||||
kAudibleProxy = 0x00040000,
|
||||
kPhysicalProxy = 0x00080000,
|
||||
kCoordinateProxy = 0x00100000,
|
||||
kOccSnapProxy = 0x00200000,
|
||||
kGenericProxy = 0x00400000,
|
||||
kCameraProxy = 0x00800000,
|
||||
kAllProxies = 0x00ff0000,
|
||||
|
||||
kAllTypes = 0xffffffff
|
||||
};
|
||||
enum plSubDrawableType {
|
||||
kSubNormal = 0x00000001,
|
||||
kSubNonDrawable = 0x00000002,
|
||||
kSubEnviron = 0x00000004,
|
||||
|
||||
kSubAllTypes = 0xffffffff
|
||||
};
|
||||
|
||||
enum plAccessFlags {
|
||||
kReadSrc = 0x1,
|
||||
kWriteDst = 0x2,
|
||||
kWriteSrc = 0x4
|
||||
};
|
||||
|
||||
enum MsgTypes
|
||||
{
|
||||
kMsgMaterial,
|
||||
kMsgDISpans, // UNUSED
|
||||
kMsgFogEnviron,
|
||||
kMsgPermaLight,
|
||||
kMsgPermaProj,
|
||||
kMsgPermaLightDI,
|
||||
kMsgPermaProjDI
|
||||
};
|
||||
|
||||
|
||||
|
||||
CLASSNAME_REGISTER( plDrawable );
|
||||
GETINTERFACE_ANY( plDrawable, hsKeyedObject );
|
||||
|
||||
virtual plDrawable& SetProperty( int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetProperty( UInt32 index, int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( UInt32 index, int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetNativeProperty( int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetNativeProperty( int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetNativeProperty( UInt32 index, int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetNativeProperty( UInt32 index, int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetSubType( UInt32 index, plSubDrawableType t, hsBool on ) = 0;
|
||||
virtual UInt32 GetSubType( UInt32 index ) const = 0; // returns or of all spans with this index (index==-1 is all spans).
|
||||
|
||||
virtual UInt32 GetType( void ) const = 0;
|
||||
virtual void SetType( UInt32 type ) = 0;
|
||||
|
||||
virtual void SetRenderLevel(const plRenderLevel& l) = 0;
|
||||
virtual const plRenderLevel& GetRenderLevel() const = 0;
|
||||
|
||||
virtual plDrawable& SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l ) = 0;
|
||||
virtual const hsMatrix44& GetLocalToWorld( UInt32 span = (UInt32)-1 ) const = 0;
|
||||
virtual const hsMatrix44& GetWorldToLocal( UInt32 span = (UInt32)-1 ) const = 0;
|
||||
|
||||
virtual const hsBounds3Ext& GetLocalBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
virtual const hsBounds3Ext& GetWorldBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
virtual const hsBounds3Ext& GetMaxWorldBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
|
||||
virtual plSpaceTree* GetSpaceTree() const = 0;
|
||||
virtual void SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* reg, hsBool on) = 0;
|
||||
|
||||
// Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc.
|
||||
virtual hsGMaterial* GetSubMaterial(int index) const = 0;
|
||||
virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist
|
||||
|
||||
// Should implement hsKeyedObject Read/Write/Save/Load as well
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
/// Funky particle system functions
|
||||
virtual UInt32 CreateParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material ) = 0;
|
||||
virtual void ResetParticleSystem( UInt32 index ) = 0;
|
||||
virtual void AssignEmitterToParticleSystem( UInt32 index, plParticleEmitter *emitter ) = 0;
|
||||
|
||||
/// EXPORT-ONLY
|
||||
|
||||
// Called by the sceneNode to determine if we match the criteria
|
||||
virtual hsBool DoIMatch( const plDrawableCriteria& crit ) = 0;
|
||||
|
||||
// Take the list of triMeshes and convert them to buffers, building a list of spans for each
|
||||
virtual void Optimize( void ) = 0;
|
||||
};
|
||||
|
||||
#endif // plDrawable_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plDrawable_inc
|
||||
#define plDrawable_inc
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "plLoadMask.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "plRenderLevel.h"
|
||||
|
||||
class plSpaceTree;
|
||||
class hsStream;
|
||||
class hsResMgr;
|
||||
struct hsMatrix44;
|
||||
class hsBounds3Ext;
|
||||
class plPipeline;
|
||||
class plGeometrySpan;
|
||||
class hsGMaterial;
|
||||
class plParticleEmitter;
|
||||
class plAccessSpan;
|
||||
|
||||
class plDrawableCriteria
|
||||
{
|
||||
public:
|
||||
plDrawableCriteria(UInt32 crit, const plRenderLevel& lev, const plLoadMask& m, UInt32 ty=1 /* Normal */ ) : fCriteria(crit), fLevel(lev), fType(ty), fLoadMask(m) {}
|
||||
UInt32 fCriteria;
|
||||
plRenderLevel fLevel;
|
||||
UInt32 fType;
|
||||
plLoadMask fLoadMask;
|
||||
};
|
||||
|
||||
class plDrawable : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
// Renumber these the next time we bump major version #s (no reason to do it now)
|
||||
kPropNoDraw = 0x01,
|
||||
kPropUNUSED = 0x02,
|
||||
kPropSortSpans = 0x04,
|
||||
kPropSortFaces = 0x08,
|
||||
kPropVolatile = 0x10, // Means that spans DEFAULT to kPropVolatile, but if this
|
||||
// is not set, spans can still be volatile
|
||||
kPropNoReSort = 0x20, // Don't do sorting of spans for optimization.
|
||||
kPropPartialSort = 0x40, // Sort spans on an individual basis.
|
||||
kPropCharacter = 0x80, // Lights want to know if this is in the general class of "characters"
|
||||
kPropSortAsOne = 0x100,
|
||||
kPropHasVisLOS = 0x200
|
||||
};
|
||||
|
||||
// Criteria for drawables. Used when searching through a sceneNode for a particular drawable
|
||||
enum
|
||||
{
|
||||
kCritStatic = 0x01,
|
||||
kCritSortSpans = 0x02,
|
||||
kCritSortFaces = 0x08,
|
||||
kCritCharacter = 0x10
|
||||
};
|
||||
// Types of drawables for rendering filtering.
|
||||
enum plDrawableType {
|
||||
kNormal = 0x00000001,
|
||||
kNonDrawable = 0x00000002, //e.g. a light, affects drawing, but isn't drawn.
|
||||
kEnviron = 0x00000004,
|
||||
|
||||
// Proxies in the upper 16 bits.
|
||||
kLightProxy = 0x00010000,
|
||||
kOccluderProxy = 0x00020000,
|
||||
kAudibleProxy = 0x00040000,
|
||||
kPhysicalProxy = 0x00080000,
|
||||
kCoordinateProxy = 0x00100000,
|
||||
kOccSnapProxy = 0x00200000,
|
||||
kGenericProxy = 0x00400000,
|
||||
kCameraProxy = 0x00800000,
|
||||
kAllProxies = 0x00ff0000,
|
||||
|
||||
kAllTypes = 0xffffffff
|
||||
};
|
||||
enum plSubDrawableType {
|
||||
kSubNormal = 0x00000001,
|
||||
kSubNonDrawable = 0x00000002,
|
||||
kSubEnviron = 0x00000004,
|
||||
|
||||
kSubAllTypes = 0xffffffff
|
||||
};
|
||||
|
||||
enum plAccessFlags {
|
||||
kReadSrc = 0x1,
|
||||
kWriteDst = 0x2,
|
||||
kWriteSrc = 0x4
|
||||
};
|
||||
|
||||
enum MsgTypes
|
||||
{
|
||||
kMsgMaterial,
|
||||
kMsgDISpans, // UNUSED
|
||||
kMsgFogEnviron,
|
||||
kMsgPermaLight,
|
||||
kMsgPermaProj,
|
||||
kMsgPermaLightDI,
|
||||
kMsgPermaProjDI
|
||||
};
|
||||
|
||||
|
||||
|
||||
CLASSNAME_REGISTER( plDrawable );
|
||||
GETINTERFACE_ANY( plDrawable, hsKeyedObject );
|
||||
|
||||
virtual plDrawable& SetProperty( int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetProperty( UInt32 index, int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( UInt32 index, int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetNativeProperty( int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetNativeProperty( int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetNativeProperty( UInt32 index, int prop, hsBool on ) = 0;
|
||||
virtual hsBool GetNativeProperty( UInt32 index, int prop ) const = 0;
|
||||
|
||||
virtual plDrawable& SetSubType( UInt32 index, plSubDrawableType t, hsBool on ) = 0;
|
||||
virtual UInt32 GetSubType( UInt32 index ) const = 0; // returns or of all spans with this index (index==-1 is all spans).
|
||||
|
||||
virtual UInt32 GetType( void ) const = 0;
|
||||
virtual void SetType( UInt32 type ) = 0;
|
||||
|
||||
virtual void SetRenderLevel(const plRenderLevel& l) = 0;
|
||||
virtual const plRenderLevel& GetRenderLevel() const = 0;
|
||||
|
||||
virtual plDrawable& SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l ) = 0;
|
||||
virtual const hsMatrix44& GetLocalToWorld( UInt32 span = (UInt32)-1 ) const = 0;
|
||||
virtual const hsMatrix44& GetWorldToLocal( UInt32 span = (UInt32)-1 ) const = 0;
|
||||
|
||||
virtual const hsBounds3Ext& GetLocalBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
virtual const hsBounds3Ext& GetWorldBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
virtual const hsBounds3Ext& GetMaxWorldBounds( UInt32 index = (UInt32)-1 ) const = 0;
|
||||
|
||||
virtual plSpaceTree* GetSpaceTree() const = 0;
|
||||
virtual void SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* reg, hsBool on) = 0;
|
||||
|
||||
// Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc.
|
||||
virtual hsGMaterial* GetSubMaterial(int index) const = 0;
|
||||
virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist
|
||||
|
||||
// Should implement hsKeyedObject Read/Write/Save/Load as well
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
/// Funky particle system functions
|
||||
virtual UInt32 CreateParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material ) = 0;
|
||||
virtual void ResetParticleSystem( UInt32 index ) = 0;
|
||||
virtual void AssignEmitterToParticleSystem( UInt32 index, plParticleEmitter *emitter ) = 0;
|
||||
|
||||
/// EXPORT-ONLY
|
||||
|
||||
// Called by the sceneNode to determine if we match the criteria
|
||||
virtual hsBool DoIMatch( const plDrawableCriteria& crit ) = 0;
|
||||
|
||||
// Take the list of triMeshes and convert them to buffers, building a list of spans for each
|
||||
virtual void Optimize( void ) = 0;
|
||||
};
|
||||
|
||||
#endif // plDrawable_inc
|
||||
|
@ -1,25 +1,25 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
@ -1,116 +1,116 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plPhysical_inc
|
||||
#define plPhysical_inc
|
||||
|
||||
#include "pnNetCommon/plSynchedObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
struct hsMatrix44;
|
||||
struct hsPoint3;
|
||||
struct hsVector3;
|
||||
class hsQuat;
|
||||
class plPhysicalSndGroup;
|
||||
class plDrawableSpans;
|
||||
class hsGMaterial;
|
||||
|
||||
// Primary interface object for physics functionality. A physical corresponds to
|
||||
// a single rigid body in a simulation. (Note that there can be multiple
|
||||
// simulations.) The plPhysical is reached through the simulation interface on a
|
||||
// plSceneObject
|
||||
//
|
||||
// Any function that ends with 'Sim' gets or sets a simulation space value. If
|
||||
// the physical is in the main world, this will be the same as a global value,
|
||||
// but if it's in a subworld, it will be relative to that.
|
||||
class plPhysical : public plSynchedObject
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER(plPhysical);
|
||||
GETINTERFACE_ANY(plPhysical, plSynchedObject);
|
||||
|
||||
virtual plPhysical& SetProperty(int prop, hsBool b) = 0;
|
||||
virtual hsBool GetProperty(int prop) const = 0;
|
||||
|
||||
virtual void SetObjectKey(plKey oKey) = 0;
|
||||
virtual plKey GetObjectKey() const = 0;
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
virtual hsBool GetLinearVelocitySim(hsVector3& vel) const = 0;
|
||||
virtual void SetLinearVelocitySim(const hsVector3& vel) = 0;
|
||||
virtual void ClearLinearVelocity() = 0;
|
||||
|
||||
virtual hsBool GetAngularVelocitySim(hsVector3& vel) const = 0;
|
||||
virtual void SetAngularVelocitySim(const hsVector3& vel) = 0;
|
||||
|
||||
virtual void SetHitForce(const hsVector3& force, const hsPoint3& pos)=0;
|
||||
/** Standard plasma transform interface, in global coordinates by convention.
|
||||
If you send in the same matrix that the physical last sent out in its correction message,
|
||||
it will be ignored as an "echo" -- UNLESS you set force to true, in which case the transform
|
||||
will be applied regardless.
|
||||
Set force to true if you don't want the transform to be ignored for any reason. Without it,
|
||||
this will ignore the incoming transform if it's the same one it sent out last time. */
|
||||
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBool force=false) = 0;
|
||||
virtual void GetTransform(hsMatrix44& l2w, hsMatrix44& w2l) = 0;
|
||||
|
||||
// From plSimDefs::Group
|
||||
virtual int GetGroup() const = 0;
|
||||
|
||||
// Flags in plSimDefs::plLOSDB
|
||||
virtual void AddLOSDB(UInt16 flag) = 0;
|
||||
virtual void RemoveLOSDB(UInt16 flag) = 0;
|
||||
virtual UInt16 GetAllLOSDBs() = 0;
|
||||
virtual hsBool IsInLOSDB(UInt16 flag) = 0;
|
||||
|
||||
// Return the key of our subworld. May be a nil key.
|
||||
virtual plKey GetWorldKey() const = 0;
|
||||
|
||||
virtual plPhysicalSndGroup* GetSoundGroup() const = 0;
|
||||
|
||||
virtual void GetPositionSim(hsPoint3& pos) const = 0;
|
||||
|
||||
/** Send the current simulation location to the coordinate interface.
|
||||
If the simulation is a subworld, this will also factor in the subworld's
|
||||
transform. The sent transform is global. "isSynchUpdate" tells us if this
|
||||
is an update due to receiving remote state.*/
|
||||
virtual void SendNewLocation(hsBool synchTransform = false, hsBool isSynchUpdate = false) = 0;
|
||||
|
||||
// For the physics SDL only. For Set, any of the values may be set to nil, if
|
||||
// they're not used.
|
||||
virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV) = 0;
|
||||
virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) = 0;
|
||||
|
||||
virtual hsScalar GetMass() = 0;
|
||||
// I wish I could think of a better way to do this, but this is how it's
|
||||
// going to be for now.
|
||||
virtual void ExcludeRegionHack(hsBool cleared) = 0;
|
||||
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo) = 0;
|
||||
};
|
||||
|
||||
#endif // plPhysical_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plPhysical_inc
|
||||
#define plPhysical_inc
|
||||
|
||||
#include "pnNetCommon/plSynchedObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
struct hsMatrix44;
|
||||
struct hsPoint3;
|
||||
struct hsVector3;
|
||||
class hsQuat;
|
||||
class plPhysicalSndGroup;
|
||||
class plDrawableSpans;
|
||||
class hsGMaterial;
|
||||
|
||||
// Primary interface object for physics functionality. A physical corresponds to
|
||||
// a single rigid body in a simulation. (Note that there can be multiple
|
||||
// simulations.) The plPhysical is reached through the simulation interface on a
|
||||
// plSceneObject
|
||||
//
|
||||
// Any function that ends with 'Sim' gets or sets a simulation space value. If
|
||||
// the physical is in the main world, this will be the same as a global value,
|
||||
// but if it's in a subworld, it will be relative to that.
|
||||
class plPhysical : public plSynchedObject
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER(plPhysical);
|
||||
GETINTERFACE_ANY(plPhysical, plSynchedObject);
|
||||
|
||||
virtual plPhysical& SetProperty(int prop, hsBool b) = 0;
|
||||
virtual hsBool GetProperty(int prop) const = 0;
|
||||
|
||||
virtual void SetObjectKey(plKey oKey) = 0;
|
||||
virtual plKey GetObjectKey() const = 0;
|
||||
|
||||
// These two should only be called by the SceneNode
|
||||
virtual void SetSceneNode(plKey node) = 0;
|
||||
virtual plKey GetSceneNode() const = 0;
|
||||
|
||||
virtual hsBool GetLinearVelocitySim(hsVector3& vel) const = 0;
|
||||
virtual void SetLinearVelocitySim(const hsVector3& vel) = 0;
|
||||
virtual void ClearLinearVelocity() = 0;
|
||||
|
||||
virtual hsBool GetAngularVelocitySim(hsVector3& vel) const = 0;
|
||||
virtual void SetAngularVelocitySim(const hsVector3& vel) = 0;
|
||||
|
||||
virtual void SetHitForce(const hsVector3& force, const hsPoint3& pos)=0;
|
||||
/** Standard plasma transform interface, in global coordinates by convention.
|
||||
If you send in the same matrix that the physical last sent out in its correction message,
|
||||
it will be ignored as an "echo" -- UNLESS you set force to true, in which case the transform
|
||||
will be applied regardless.
|
||||
Set force to true if you don't want the transform to be ignored for any reason. Without it,
|
||||
this will ignore the incoming transform if it's the same one it sent out last time. */
|
||||
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBool force=false) = 0;
|
||||
virtual void GetTransform(hsMatrix44& l2w, hsMatrix44& w2l) = 0;
|
||||
|
||||
// From plSimDefs::Group
|
||||
virtual int GetGroup() const = 0;
|
||||
|
||||
// Flags in plSimDefs::plLOSDB
|
||||
virtual void AddLOSDB(UInt16 flag) = 0;
|
||||
virtual void RemoveLOSDB(UInt16 flag) = 0;
|
||||
virtual UInt16 GetAllLOSDBs() = 0;
|
||||
virtual hsBool IsInLOSDB(UInt16 flag) = 0;
|
||||
|
||||
// Return the key of our subworld. May be a nil key.
|
||||
virtual plKey GetWorldKey() const = 0;
|
||||
|
||||
virtual plPhysicalSndGroup* GetSoundGroup() const = 0;
|
||||
|
||||
virtual void GetPositionSim(hsPoint3& pos) const = 0;
|
||||
|
||||
/** Send the current simulation location to the coordinate interface.
|
||||
If the simulation is a subworld, this will also factor in the subworld's
|
||||
transform. The sent transform is global. "isSynchUpdate" tells us if this
|
||||
is an update due to receiving remote state.*/
|
||||
virtual void SendNewLocation(hsBool synchTransform = false, hsBool isSynchUpdate = false) = 0;
|
||||
|
||||
// For the physics SDL only. For Set, any of the values may be set to nil, if
|
||||
// they're not used.
|
||||
virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV) = 0;
|
||||
virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) = 0;
|
||||
|
||||
virtual hsScalar GetMass() = 0;
|
||||
// I wish I could think of a better way to do this, but this is how it's
|
||||
// going to be for now.
|
||||
virtual void ExcludeRegionHack(hsBool cleared) = 0;
|
||||
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo) = 0;
|
||||
};
|
||||
|
||||
#endif // plPhysical_inc
|
||||
|
@ -1,53 +1,53 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plPipeResReq_inc
|
||||
#define plPipeResReq_inc
|
||||
|
||||
//#define PIPERES_VERBOSE
|
||||
#ifdef PIPERES_VERBOSE
|
||||
#define PIPELOG(a) hsStatusMessage(a)
|
||||
#else // PIPERES_VERBOSE
|
||||
#define PIPELOG(a)
|
||||
#endif // PIPERES_VERBOSE
|
||||
|
||||
class plPipeResReq
|
||||
{
|
||||
protected:
|
||||
hsBool fReq;
|
||||
|
||||
plPipeResReq() : fReq(false) {}
|
||||
|
||||
static plPipeResReq& Instance();
|
||||
|
||||
public:
|
||||
|
||||
static void Request() { PIPELOG("Request"); Instance().fReq = true; }
|
||||
static hsBool Check() { PIPELOG("Check"); return Instance().fReq; }
|
||||
static void Clear() { PIPELOG("Clear"); Instance().fReq = false; }
|
||||
};
|
||||
|
||||
#endif // plPipeResReq_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plPipeResReq_inc
|
||||
#define plPipeResReq_inc
|
||||
|
||||
//#define PIPERES_VERBOSE
|
||||
#ifdef PIPERES_VERBOSE
|
||||
#define PIPELOG(a) hsStatusMessage(a)
|
||||
#else // PIPERES_VERBOSE
|
||||
#define PIPELOG(a)
|
||||
#endif // PIPERES_VERBOSE
|
||||
|
||||
class plPipeResReq
|
||||
{
|
||||
protected:
|
||||
hsBool fReq;
|
||||
|
||||
plPipeResReq() : fReq(false) {}
|
||||
|
||||
static plPipeResReq& Instance();
|
||||
|
||||
public:
|
||||
|
||||
static void Request() { PIPELOG("Request"); Instance().fReq = true; }
|
||||
static hsBool Check() { PIPELOG("Check"); return Instance().fReq; }
|
||||
static void Clear() { PIPELOG("Clear"); Instance().fReq = false; }
|
||||
};
|
||||
|
||||
#endif // plPipeResReq_inc
|
||||
|
@ -1,346 +1,346 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plPipeline_inc
|
||||
#define plPipeline_inc
|
||||
|
||||
#include "pnFactory/plCreatable.h"
|
||||
#include "hsGMatState.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "hsStlUtils.h"
|
||||
|
||||
#define MIN_WIDTH 640
|
||||
#define MIN_HEIGHT 480
|
||||
|
||||
#define DEFAULT_WIDTH 800
|
||||
#define DEFAULT_HEIGHT 600
|
||||
#define DEFAULT_WINDOWED false
|
||||
#define DEFAULT_COLORDEPTH 32
|
||||
#define DEFAULT_ANTIALIASAMOUNT 0
|
||||
#define DEFAULT_ANISOLEVEL 0
|
||||
#define DEFAULT_TEXTUREQUALITY 2
|
||||
#define DEFAULT_VIDEOQUALITY 2
|
||||
#define DEFAULT_SHADOWS 0
|
||||
#define DEFAULT_PLANARREFLECTIONS 0
|
||||
|
||||
|
||||
struct hsPoint3;
|
||||
struct hsVector3;
|
||||
struct hsMatrix44;
|
||||
struct hsColorRGBA;
|
||||
class hsBounds3Ext;
|
||||
class hsGMaterial;
|
||||
class plDrawPrim;
|
||||
class plRenderTarget;
|
||||
class hsG3DDevice;
|
||||
class hsGView3;
|
||||
class plDrawable;
|
||||
class plGBufferGroup;
|
||||
class plLayerInterface;
|
||||
class plSpaceTree;
|
||||
class plCullPoly;
|
||||
class plRenderRequest;
|
||||
class plShadowSlave;
|
||||
class plAccessSpan;
|
||||
class plTextFont;
|
||||
class plVertexSpan;
|
||||
class plDrawableSpans;
|
||||
class plSceneObject;
|
||||
class plClothingOutfit;
|
||||
class hsGDeviceRef;
|
||||
class plFogEnvironment;
|
||||
class plLightInfo;
|
||||
class plMipmap;
|
||||
class plVisMgr;
|
||||
|
||||
class plViewTransform;
|
||||
|
||||
|
||||
struct PipelineParams
|
||||
{
|
||||
PipelineParams():
|
||||
Width(DEFAULT_WIDTH),
|
||||
Height(DEFAULT_HEIGHT),
|
||||
Windowed(DEFAULT_WINDOWED),
|
||||
ColorDepth(DEFAULT_COLORDEPTH),
|
||||
AntiAliasingAmount(DEFAULT_ANTIALIASAMOUNT),
|
||||
AnisotropicLevel(DEFAULT_ANISOLEVEL),
|
||||
TextureQuality(DEFAULT_TEXTUREQUALITY),
|
||||
VideoQuality(DEFAULT_VIDEOQUALITY),
|
||||
Shadows(DEFAULT_SHADOWS),
|
||||
PlanarReflections(DEFAULT_PLANARREFLECTIONS),
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
ForceSecondMonitor(false),
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
VSync(false)
|
||||
{
|
||||
}
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
hsBool Windowed;
|
||||
int ColorDepth;
|
||||
int AntiAliasingAmount;
|
||||
int AnisotropicLevel;
|
||||
int TextureQuality;
|
||||
int VideoQuality;
|
||||
int Shadows;
|
||||
int PlanarReflections;
|
||||
hsBool VSync;
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
hsBool ForceSecondMonitor;
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
};
|
||||
|
||||
class plDisplayMode
|
||||
{
|
||||
public:
|
||||
int Width;
|
||||
int Height;
|
||||
int ColorDepth;
|
||||
};
|
||||
|
||||
class plPipeline : public plCreatable
|
||||
{
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plPipeline );
|
||||
GETINTERFACE_ANY( plPipeline, plCreatable );
|
||||
|
||||
// Typical 3D device
|
||||
//
|
||||
// PreRender - fill out the visList with which spans from drawable will be drawn.
|
||||
// visList is write only. On output, visList is UNSORTED visible spans.
|
||||
// Called once per scene render (maybe multiple times per frame).
|
||||
// Returns true if rendering should proceed.
|
||||
virtual hsBool PreRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil) = 0;
|
||||
// PrepForRender - perform any processing on the drawable data nessecary before rendering.
|
||||
// visList is read only. On input, visList is SORTED visible spans, and is ALL spans which will be drawn this render.
|
||||
// Called once per scene render.
|
||||
// Returns true if rendering should proceed.
|
||||
virtual hsBool PrepForRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil) = 0;
|
||||
// Render - draw the drawable to the current render target.
|
||||
// visList is read only. On input, visList is SORTED visible spans. May not be the complete list of visible spans
|
||||
// for this drawable.
|
||||
// Called multiple times per scene render e.g.:
|
||||
// Render(drawable0, visList0) // visList0 contains furthest spans in drawable0
|
||||
// Render(drawable1, visList1) // visList1 contains spans from drawable1 between drawable0's visList0 and visList2
|
||||
// Render(drawable0, visList2) // visList2 contains closest spans in drawable0.
|
||||
virtual void Render(plDrawable* d, const hsTArray<Int16>& visList) = 0;
|
||||
// Draw - Convenience wrapper for standalone renders. Calls PreRender, PrepForRender, Render. Currently for internal
|
||||
// use only, but may prove useful for procedurals (render to texture).
|
||||
virtual void Draw(plDrawable* d) = 0;
|
||||
|
||||
// Device-specific ref creation. Includes buffers and fonts
|
||||
virtual plTextFont *MakeTextFont( char *face, UInt16 size ) = 0;
|
||||
|
||||
// Create and/or Refresh geometry buffers
|
||||
virtual void CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0;
|
||||
virtual void CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0;
|
||||
|
||||
virtual hsBool OpenAccess(plAccessSpan& dst, plDrawableSpans* d, const plVertexSpan* span, hsBool readOnly) = 0;
|
||||
virtual hsBool CloseAccess(plAccessSpan& acc) = 0;
|
||||
|
||||
virtual void CheckTextureRef(plLayerInterface* lay) = 0;
|
||||
|
||||
// Default fog settings
|
||||
virtual void SetDefaultFogEnviron( plFogEnvironment *fog ) = 0;
|
||||
virtual const plFogEnvironment &GetDefaultFogEnviron( void ) const = 0;
|
||||
|
||||
virtual void RegisterLight(plLightInfo* light) = 0;
|
||||
virtual void UnRegisterLight(plLightInfo* light) = 0;
|
||||
|
||||
enum RenderTargetFlags
|
||||
{
|
||||
kRTMainScreen = 0x0000,
|
||||
kRTOffscreen = 0x0001,
|
||||
kRTTexture = 0x0002,
|
||||
kRTPerspProjected = 0x0004,
|
||||
kRTOrthoProjected = 0x0008,
|
||||
kRTProjected = kRTPerspProjected | kRTOrthoProjected
|
||||
};
|
||||
enum RenderStateSettings
|
||||
{
|
||||
kRenderNormal = 0x0,
|
||||
kRenderProjection = 0x1,
|
||||
kRenderShadow = 0x2,
|
||||
kRenderBaseLayerOnly = 0x4,
|
||||
kRenderNoPiggyBacks = 0x8,
|
||||
kRenderClearColor = 0x10,
|
||||
kRenderClearDepth = 0x20,
|
||||
kRenderOrthogonal = 0x40,
|
||||
kRenderNoProjection = 0x80,
|
||||
kRenderNoLights = 0x100,
|
||||
kRenderShadowErase = 0x200
|
||||
};
|
||||
|
||||
virtual void PushRenderRequest(plRenderRequest* req) = 0;
|
||||
virtual void PopRenderRequest(plRenderRequest* req) = 0;
|
||||
|
||||
virtual void ClearRenderTarget( plDrawable* d ) = 0; // nil d reverts to ClearRenderTarget(nil, nil).
|
||||
virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const hsScalar* depth = nil) = 0; // col/depth are overrides for current default.
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil) = 0; // sets the default clear for current render target.
|
||||
virtual hsColorRGBA GetClearColor() const = 0;
|
||||
virtual hsScalar GetClearDepth() const = 0;
|
||||
virtual hsGDeviceRef *MakeRenderTargetRef( plRenderTarget *owner ) = 0;
|
||||
virtual void PushRenderTarget( plRenderTarget *target ) = 0;
|
||||
virtual plRenderTarget *PopRenderTarget( void ) = 0;
|
||||
|
||||
virtual hsBool BeginRender() = 0;
|
||||
virtual hsBool EndRender() = 0;
|
||||
virtual void RenderScreenElements( void ) = 0;
|
||||
|
||||
virtual hsBool BeginDrawable(plDrawable* d) = 0;
|
||||
virtual hsBool EndDrawable(plDrawable* d) = 0;
|
||||
|
||||
virtual void BeginVisMgr(plVisMgr* visMgr) = 0;
|
||||
virtual void EndVisMgr(plVisMgr* visMgr) = 0;
|
||||
|
||||
virtual hsBool IsFullScreen() const = 0;
|
||||
virtual UInt32 Width() const = 0;
|
||||
virtual UInt32 Height() const = 0;
|
||||
virtual UInt32 ColorDepth() const = 0;
|
||||
virtual void Resize( UInt32 width, UInt32 height ) = 0;
|
||||
|
||||
// Culling. Might be used in Update before bothering to do any serious computation.
|
||||
virtual hsBool TestVisibleWorld(const hsBounds3Ext& wBnd) = 0;
|
||||
virtual hsBool TestVisibleWorld(const plSceneObject* sObj) = 0;
|
||||
virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray<Int16>& visList) = 0;
|
||||
virtual hsBool SubmitOccluders(const hsTArray<const plCullPoly*>& polyList) = 0;
|
||||
|
||||
virtual void SetDebugFlag( UInt32 flag, hsBool on ) = 0;
|
||||
virtual hsBool IsDebugFlagSet( UInt32 flag ) const = 0;
|
||||
virtual void SetMaxCullNodes(UInt16 n) = 0; // Debug/analysis only
|
||||
virtual UInt16 GetMaxCullNodes() const = 0; // Debug/analysis only
|
||||
|
||||
// Properties
|
||||
enum Properties
|
||||
{
|
||||
kPropDontDeleteTextures = 0x00000001 // Keeps the pipeline from deleting textures on
|
||||
// MakeTextureRef, regardless of the kUserOwnsBitmap flag
|
||||
};
|
||||
|
||||
virtual hsBool CheckResources() = 0; // Do we need to call LoadResources?
|
||||
virtual void LoadResources() = 0;
|
||||
|
||||
virtual void SetProperty( UInt32 prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( UInt32 prop ) const = 0;
|
||||
virtual UInt32 GetMaxLayersAtOnce() const = 0;
|
||||
|
||||
// Drawable type mask
|
||||
virtual void SetDrawableTypeMask( UInt32 mask ) = 0;
|
||||
virtual UInt32 GetDrawableTypeMask( void ) const = 0;
|
||||
virtual void SetSubDrawableTypeMask( UInt32 mask ) = 0;
|
||||
virtual UInt32 GetSubDrawableTypeMask( void ) const = 0;
|
||||
|
||||
// View state
|
||||
virtual hsPoint3 GetViewPositionWorld() const = 0;
|
||||
virtual hsVector3 GetViewAcrossWorld() const = 0;
|
||||
virtual hsVector3 GetViewUpWorld() const = 0;
|
||||
virtual hsVector3 GetViewDirWorld() const = 0;
|
||||
virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const = 0;
|
||||
|
||||
virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const = 0;
|
||||
virtual void SetFOV(hsScalar fovX, hsScalar fovY) = 0;
|
||||
|
||||
virtual void GetSize(hsScalar& width, hsScalar& height) const = 0;
|
||||
virtual void SetSize(hsScalar width, hsScalar height) = 0;
|
||||
|
||||
virtual void GetDepth(hsScalar& hither, hsScalar& yon) const = 0;
|
||||
virtual void SetDepth(hsScalar hither, hsScalar yon) = 0;
|
||||
|
||||
virtual void SetZBiasScale( hsScalar scale ) = 0;
|
||||
virtual hsScalar GetZBiasScale( void ) const = 0;
|
||||
|
||||
virtual const hsMatrix44& GetWorldToCamera() const = 0;
|
||||
virtual const hsMatrix44& GetCameraToWorld() const = 0;
|
||||
virtual void SetWorldToCamera(const hsMatrix44& w2c, const hsMatrix44& c2w) = 0;
|
||||
|
||||
virtual const hsMatrix44& GetWorldToLocal() const = 0;
|
||||
virtual const hsMatrix44& GetLocalToWorld() const = 0;
|
||||
|
||||
virtual const plViewTransform& GetViewTransform() const = 0;
|
||||
|
||||
virtual void ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY,
|
||||
hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut ) = 0;
|
||||
|
||||
virtual void RefreshMatrices( void ) = 0;
|
||||
virtual void RefreshScreenMatrices( void ) = 0;
|
||||
|
||||
// Overrides, always push returns whatever is necessary to restore on pop.
|
||||
virtual hsGMaterial* PushOverrideMaterial(hsGMaterial* mat) = 0;
|
||||
virtual void PopOverrideMaterial(hsGMaterial* restore) = 0;
|
||||
virtual hsGMaterial* GetOverrideMaterial() const = 0;
|
||||
|
||||
virtual plLayerInterface* AppendLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0;
|
||||
virtual plLayerInterface* RemoveLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0;
|
||||
|
||||
virtual UInt32 GetMaterialOverrideOn(hsGMatState::StateIdx category) const = 0;
|
||||
virtual UInt32 GetMaterialOverrideOff(hsGMatState::StateIdx category) const = 0;
|
||||
|
||||
virtual hsGMatState PushMaterialOverride(const hsGMatState& state, hsBool on) = 0;
|
||||
virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on) = 0;
|
||||
virtual void PopMaterialOverride(const hsGMatState& restore, hsBool on) = 0;
|
||||
virtual const hsGMatState& GetMaterialOverride(hsBool on) const = 0;
|
||||
|
||||
virtual hsColorOverride PushColorOverride(const hsColorOverride& over) = 0;
|
||||
virtual void PopColorOverride(const hsColorOverride& restore) = 0;
|
||||
virtual const hsColorOverride& GetColorOverride() const = 0;
|
||||
|
||||
virtual void SubmitShadowSlave(plShadowSlave* slave) = 0;
|
||||
virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0;
|
||||
|
||||
// These all return true if the gamma was successfully set.
|
||||
virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) = 0;
|
||||
virtual hsBool SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB) = 0; // len table = 256.
|
||||
virtual hsBool SetGamma(hsScalar e) { return SetGamma(e, e, e); }
|
||||
virtual hsBool SetGamma(const UInt16* const table) { return SetGamma(table, table, table); }
|
||||
|
||||
// flipVertical is for the AVI writer, which wants it's frames upside down
|
||||
virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, UInt16 desiredWidth = 0, UInt16 desiredHeight = 0 ) = 0;
|
||||
|
||||
// Returns an un-named (GetKey()==nil) mipmap same dimensions as targ. You are responsible for deleting said mipMap.
|
||||
virtual plMipmap* ExtractMipMap(plRenderTarget* targ) = 0;
|
||||
|
||||
/// Error handling
|
||||
virtual const char *GetErrorString( void ) = 0;
|
||||
|
||||
// info about current rendering device
|
||||
virtual void GetSupportedDisplayModes(std::vector<plDisplayMode> *res, int ColorDepth = 32 ) = 0;
|
||||
virtual int GetMaxAnisotropicSamples() = 0;
|
||||
virtual int GetMaxAntiAlias(int Width, int Height, int ColorDepth) = 0;
|
||||
int GetDesktopWidth() { return fDesktopParams.Width; }
|
||||
int GetDesktopHeight() { return fDesktopParams.Height; }
|
||||
int GetDesktopColorDepth() { return fDesktopParams.ColorDepth; }
|
||||
PipelineParams *GetDefaultParams() { return &fDefaultPipeParams; }
|
||||
|
||||
virtual void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool vSync = false ) = 0;
|
||||
static PipelineParams fDefaultPipeParams;
|
||||
static PipelineParams fInitialPipeParams;
|
||||
plDisplayMode fDesktopParams;
|
||||
};
|
||||
|
||||
#endif // plPipeline_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plPipeline_inc
|
||||
#define plPipeline_inc
|
||||
|
||||
#include "pnFactory/plCreatable.h"
|
||||
#include "hsGMatState.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "hsStlUtils.h"
|
||||
|
||||
#define MIN_WIDTH 640
|
||||
#define MIN_HEIGHT 480
|
||||
|
||||
#define DEFAULT_WIDTH 800
|
||||
#define DEFAULT_HEIGHT 600
|
||||
#define DEFAULT_WINDOWED false
|
||||
#define DEFAULT_COLORDEPTH 32
|
||||
#define DEFAULT_ANTIALIASAMOUNT 0
|
||||
#define DEFAULT_ANISOLEVEL 0
|
||||
#define DEFAULT_TEXTUREQUALITY 2
|
||||
#define DEFAULT_VIDEOQUALITY 2
|
||||
#define DEFAULT_SHADOWS 0
|
||||
#define DEFAULT_PLANARREFLECTIONS 0
|
||||
|
||||
|
||||
struct hsPoint3;
|
||||
struct hsVector3;
|
||||
struct hsMatrix44;
|
||||
struct hsColorRGBA;
|
||||
class hsBounds3Ext;
|
||||
class hsGMaterial;
|
||||
class plDrawPrim;
|
||||
class plRenderTarget;
|
||||
class hsG3DDevice;
|
||||
class hsGView3;
|
||||
class plDrawable;
|
||||
class plGBufferGroup;
|
||||
class plLayerInterface;
|
||||
class plSpaceTree;
|
||||
class plCullPoly;
|
||||
class plRenderRequest;
|
||||
class plShadowSlave;
|
||||
class plAccessSpan;
|
||||
class plTextFont;
|
||||
class plVertexSpan;
|
||||
class plDrawableSpans;
|
||||
class plSceneObject;
|
||||
class plClothingOutfit;
|
||||
class hsGDeviceRef;
|
||||
class plFogEnvironment;
|
||||
class plLightInfo;
|
||||
class plMipmap;
|
||||
class plVisMgr;
|
||||
|
||||
class plViewTransform;
|
||||
|
||||
|
||||
struct PipelineParams
|
||||
{
|
||||
PipelineParams():
|
||||
Width(DEFAULT_WIDTH),
|
||||
Height(DEFAULT_HEIGHT),
|
||||
Windowed(DEFAULT_WINDOWED),
|
||||
ColorDepth(DEFAULT_COLORDEPTH),
|
||||
AntiAliasingAmount(DEFAULT_ANTIALIASAMOUNT),
|
||||
AnisotropicLevel(DEFAULT_ANISOLEVEL),
|
||||
TextureQuality(DEFAULT_TEXTUREQUALITY),
|
||||
VideoQuality(DEFAULT_VIDEOQUALITY),
|
||||
Shadows(DEFAULT_SHADOWS),
|
||||
PlanarReflections(DEFAULT_PLANARREFLECTIONS),
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
ForceSecondMonitor(false),
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
VSync(false)
|
||||
{
|
||||
}
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
hsBool Windowed;
|
||||
int ColorDepth;
|
||||
int AntiAliasingAmount;
|
||||
int AnisotropicLevel;
|
||||
int TextureQuality;
|
||||
int VideoQuality;
|
||||
int Shadows;
|
||||
int PlanarReflections;
|
||||
hsBool VSync;
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
hsBool ForceSecondMonitor;
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
};
|
||||
|
||||
class plDisplayMode
|
||||
{
|
||||
public:
|
||||
int Width;
|
||||
int Height;
|
||||
int ColorDepth;
|
||||
};
|
||||
|
||||
class plPipeline : public plCreatable
|
||||
{
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plPipeline );
|
||||
GETINTERFACE_ANY( plPipeline, plCreatable );
|
||||
|
||||
// Typical 3D device
|
||||
//
|
||||
// PreRender - fill out the visList with which spans from drawable will be drawn.
|
||||
// visList is write only. On output, visList is UNSORTED visible spans.
|
||||
// Called once per scene render (maybe multiple times per frame).
|
||||
// Returns true if rendering should proceed.
|
||||
virtual hsBool PreRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil) = 0;
|
||||
// PrepForRender - perform any processing on the drawable data nessecary before rendering.
|
||||
// visList is read only. On input, visList is SORTED visible spans, and is ALL spans which will be drawn this render.
|
||||
// Called once per scene render.
|
||||
// Returns true if rendering should proceed.
|
||||
virtual hsBool PrepForRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil) = 0;
|
||||
// Render - draw the drawable to the current render target.
|
||||
// visList is read only. On input, visList is SORTED visible spans. May not be the complete list of visible spans
|
||||
// for this drawable.
|
||||
// Called multiple times per scene render e.g.:
|
||||
// Render(drawable0, visList0) // visList0 contains furthest spans in drawable0
|
||||
// Render(drawable1, visList1) // visList1 contains spans from drawable1 between drawable0's visList0 and visList2
|
||||
// Render(drawable0, visList2) // visList2 contains closest spans in drawable0.
|
||||
virtual void Render(plDrawable* d, const hsTArray<Int16>& visList) = 0;
|
||||
// Draw - Convenience wrapper for standalone renders. Calls PreRender, PrepForRender, Render. Currently for internal
|
||||
// use only, but may prove useful for procedurals (render to texture).
|
||||
virtual void Draw(plDrawable* d) = 0;
|
||||
|
||||
// Device-specific ref creation. Includes buffers and fonts
|
||||
virtual plTextFont *MakeTextFont( char *face, UInt16 size ) = 0;
|
||||
|
||||
// Create and/or Refresh geometry buffers
|
||||
virtual void CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0;
|
||||
virtual void CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx) = 0;
|
||||
|
||||
virtual hsBool OpenAccess(plAccessSpan& dst, plDrawableSpans* d, const plVertexSpan* span, hsBool readOnly) = 0;
|
||||
virtual hsBool CloseAccess(plAccessSpan& acc) = 0;
|
||||
|
||||
virtual void CheckTextureRef(plLayerInterface* lay) = 0;
|
||||
|
||||
// Default fog settings
|
||||
virtual void SetDefaultFogEnviron( plFogEnvironment *fog ) = 0;
|
||||
virtual const plFogEnvironment &GetDefaultFogEnviron( void ) const = 0;
|
||||
|
||||
virtual void RegisterLight(plLightInfo* light) = 0;
|
||||
virtual void UnRegisterLight(plLightInfo* light) = 0;
|
||||
|
||||
enum RenderTargetFlags
|
||||
{
|
||||
kRTMainScreen = 0x0000,
|
||||
kRTOffscreen = 0x0001,
|
||||
kRTTexture = 0x0002,
|
||||
kRTPerspProjected = 0x0004,
|
||||
kRTOrthoProjected = 0x0008,
|
||||
kRTProjected = kRTPerspProjected | kRTOrthoProjected
|
||||
};
|
||||
enum RenderStateSettings
|
||||
{
|
||||
kRenderNormal = 0x0,
|
||||
kRenderProjection = 0x1,
|
||||
kRenderShadow = 0x2,
|
||||
kRenderBaseLayerOnly = 0x4,
|
||||
kRenderNoPiggyBacks = 0x8,
|
||||
kRenderClearColor = 0x10,
|
||||
kRenderClearDepth = 0x20,
|
||||
kRenderOrthogonal = 0x40,
|
||||
kRenderNoProjection = 0x80,
|
||||
kRenderNoLights = 0x100,
|
||||
kRenderShadowErase = 0x200
|
||||
};
|
||||
|
||||
virtual void PushRenderRequest(plRenderRequest* req) = 0;
|
||||
virtual void PopRenderRequest(plRenderRequest* req) = 0;
|
||||
|
||||
virtual void ClearRenderTarget( plDrawable* d ) = 0; // nil d reverts to ClearRenderTarget(nil, nil).
|
||||
virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const hsScalar* depth = nil) = 0; // col/depth are overrides for current default.
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil) = 0; // sets the default clear for current render target.
|
||||
virtual hsColorRGBA GetClearColor() const = 0;
|
||||
virtual hsScalar GetClearDepth() const = 0;
|
||||
virtual hsGDeviceRef *MakeRenderTargetRef( plRenderTarget *owner ) = 0;
|
||||
virtual void PushRenderTarget( plRenderTarget *target ) = 0;
|
||||
virtual plRenderTarget *PopRenderTarget( void ) = 0;
|
||||
|
||||
virtual hsBool BeginRender() = 0;
|
||||
virtual hsBool EndRender() = 0;
|
||||
virtual void RenderScreenElements( void ) = 0;
|
||||
|
||||
virtual hsBool BeginDrawable(plDrawable* d) = 0;
|
||||
virtual hsBool EndDrawable(plDrawable* d) = 0;
|
||||
|
||||
virtual void BeginVisMgr(plVisMgr* visMgr) = 0;
|
||||
virtual void EndVisMgr(plVisMgr* visMgr) = 0;
|
||||
|
||||
virtual hsBool IsFullScreen() const = 0;
|
||||
virtual UInt32 Width() const = 0;
|
||||
virtual UInt32 Height() const = 0;
|
||||
virtual UInt32 ColorDepth() const = 0;
|
||||
virtual void Resize( UInt32 width, UInt32 height ) = 0;
|
||||
|
||||
// Culling. Might be used in Update before bothering to do any serious computation.
|
||||
virtual hsBool TestVisibleWorld(const hsBounds3Ext& wBnd) = 0;
|
||||
virtual hsBool TestVisibleWorld(const plSceneObject* sObj) = 0;
|
||||
virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray<Int16>& visList) = 0;
|
||||
virtual hsBool SubmitOccluders(const hsTArray<const plCullPoly*>& polyList) = 0;
|
||||
|
||||
virtual void SetDebugFlag( UInt32 flag, hsBool on ) = 0;
|
||||
virtual hsBool IsDebugFlagSet( UInt32 flag ) const = 0;
|
||||
virtual void SetMaxCullNodes(UInt16 n) = 0; // Debug/analysis only
|
||||
virtual UInt16 GetMaxCullNodes() const = 0; // Debug/analysis only
|
||||
|
||||
// Properties
|
||||
enum Properties
|
||||
{
|
||||
kPropDontDeleteTextures = 0x00000001 // Keeps the pipeline from deleting textures on
|
||||
// MakeTextureRef, regardless of the kUserOwnsBitmap flag
|
||||
};
|
||||
|
||||
virtual hsBool CheckResources() = 0; // Do we need to call LoadResources?
|
||||
virtual void LoadResources() = 0;
|
||||
|
||||
virtual void SetProperty( UInt32 prop, hsBool on ) = 0;
|
||||
virtual hsBool GetProperty( UInt32 prop ) const = 0;
|
||||
virtual UInt32 GetMaxLayersAtOnce() const = 0;
|
||||
|
||||
// Drawable type mask
|
||||
virtual void SetDrawableTypeMask( UInt32 mask ) = 0;
|
||||
virtual UInt32 GetDrawableTypeMask( void ) const = 0;
|
||||
virtual void SetSubDrawableTypeMask( UInt32 mask ) = 0;
|
||||
virtual UInt32 GetSubDrawableTypeMask( void ) const = 0;
|
||||
|
||||
// View state
|
||||
virtual hsPoint3 GetViewPositionWorld() const = 0;
|
||||
virtual hsVector3 GetViewAcrossWorld() const = 0;
|
||||
virtual hsVector3 GetViewUpWorld() const = 0;
|
||||
virtual hsVector3 GetViewDirWorld() const = 0;
|
||||
virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const = 0;
|
||||
|
||||
virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const = 0;
|
||||
virtual void SetFOV(hsScalar fovX, hsScalar fovY) = 0;
|
||||
|
||||
virtual void GetSize(hsScalar& width, hsScalar& height) const = 0;
|
||||
virtual void SetSize(hsScalar width, hsScalar height) = 0;
|
||||
|
||||
virtual void GetDepth(hsScalar& hither, hsScalar& yon) const = 0;
|
||||
virtual void SetDepth(hsScalar hither, hsScalar yon) = 0;
|
||||
|
||||
virtual void SetZBiasScale( hsScalar scale ) = 0;
|
||||
virtual hsScalar GetZBiasScale( void ) const = 0;
|
||||
|
||||
virtual const hsMatrix44& GetWorldToCamera() const = 0;
|
||||
virtual const hsMatrix44& GetCameraToWorld() const = 0;
|
||||
virtual void SetWorldToCamera(const hsMatrix44& w2c, const hsMatrix44& c2w) = 0;
|
||||
|
||||
virtual const hsMatrix44& GetWorldToLocal() const = 0;
|
||||
virtual const hsMatrix44& GetLocalToWorld() const = 0;
|
||||
|
||||
virtual const plViewTransform& GetViewTransform() const = 0;
|
||||
|
||||
virtual void ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY,
|
||||
hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut ) = 0;
|
||||
|
||||
virtual void RefreshMatrices( void ) = 0;
|
||||
virtual void RefreshScreenMatrices( void ) = 0;
|
||||
|
||||
// Overrides, always push returns whatever is necessary to restore on pop.
|
||||
virtual hsGMaterial* PushOverrideMaterial(hsGMaterial* mat) = 0;
|
||||
virtual void PopOverrideMaterial(hsGMaterial* restore) = 0;
|
||||
virtual hsGMaterial* GetOverrideMaterial() const = 0;
|
||||
|
||||
virtual plLayerInterface* AppendLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0;
|
||||
virtual plLayerInterface* RemoveLayerInterface(plLayerInterface* li, hsBool onAllLayers = false) = 0;
|
||||
|
||||
virtual UInt32 GetMaterialOverrideOn(hsGMatState::StateIdx category) const = 0;
|
||||
virtual UInt32 GetMaterialOverrideOff(hsGMatState::StateIdx category) const = 0;
|
||||
|
||||
virtual hsGMatState PushMaterialOverride(const hsGMatState& state, hsBool on) = 0;
|
||||
virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on) = 0;
|
||||
virtual void PopMaterialOverride(const hsGMatState& restore, hsBool on) = 0;
|
||||
virtual const hsGMatState& GetMaterialOverride(hsBool on) const = 0;
|
||||
|
||||
virtual hsColorOverride PushColorOverride(const hsColorOverride& over) = 0;
|
||||
virtual void PopColorOverride(const hsColorOverride& restore) = 0;
|
||||
virtual const hsColorOverride& GetColorOverride() const = 0;
|
||||
|
||||
virtual void SubmitShadowSlave(plShadowSlave* slave) = 0;
|
||||
virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0;
|
||||
|
||||
// These all return true if the gamma was successfully set.
|
||||
virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) = 0;
|
||||
virtual hsBool SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB) = 0; // len table = 256.
|
||||
virtual hsBool SetGamma(hsScalar e) { return SetGamma(e, e, e); }
|
||||
virtual hsBool SetGamma(const UInt16* const table) { return SetGamma(table, table, table); }
|
||||
|
||||
// flipVertical is for the AVI writer, which wants it's frames upside down
|
||||
virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, UInt16 desiredWidth = 0, UInt16 desiredHeight = 0 ) = 0;
|
||||
|
||||
// Returns an un-named (GetKey()==nil) mipmap same dimensions as targ. You are responsible for deleting said mipMap.
|
||||
virtual plMipmap* ExtractMipMap(plRenderTarget* targ) = 0;
|
||||
|
||||
/// Error handling
|
||||
virtual const char *GetErrorString( void ) = 0;
|
||||
|
||||
// info about current rendering device
|
||||
virtual void GetSupportedDisplayModes(std::vector<plDisplayMode> *res, int ColorDepth = 32 ) = 0;
|
||||
virtual int GetMaxAnisotropicSamples() = 0;
|
||||
virtual int GetMaxAntiAlias(int Width, int Height, int ColorDepth) = 0;
|
||||
int GetDesktopWidth() { return fDesktopParams.Width; }
|
||||
int GetDesktopHeight() { return fDesktopParams.Height; }
|
||||
int GetDesktopColorDepth() { return fDesktopParams.ColorDepth; }
|
||||
PipelineParams *GetDefaultParams() { return &fDefaultPipeParams; }
|
||||
|
||||
virtual void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool vSync = false ) = 0;
|
||||
static PipelineParams fDefaultPipeParams;
|
||||
static PipelineParams fInitialPipeParams;
|
||||
plDisplayMode fDesktopParams;
|
||||
};
|
||||
|
||||
#endif // plPipeline_inc
|
||||
|
@ -1,236 +1,236 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfile_h_inc
|
||||
#define plProfile_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
#define PL_PROFILE_ENABLED
|
||||
#endif
|
||||
|
||||
//
|
||||
// These macros are all you should need to use to profile your code. They are
|
||||
// compiled out in external release mode for maximum performance.
|
||||
//
|
||||
// plProfile_Create* should only be used at global scope, not in functions.
|
||||
// Use plProfile_Extern if the plProfile_Create* for a variable is in another source file.
|
||||
//
|
||||
// --Examples--
|
||||
//
|
||||
// plProfile_CreateCounter("Num Foobars", "Test", NumFoobars);
|
||||
// void SomeFunc1()
|
||||
// {
|
||||
// plProfile_Inc(NumFoobars);
|
||||
// plProfile_IncCount(NumFoobars, 5);
|
||||
// }
|
||||
//
|
||||
// plProfile_CreateTimer("Foobar Time", "Test", FoobarTime);
|
||||
// void SomeFunc2()
|
||||
// {
|
||||
// plProfile_BeginTiming(FoobarTime);
|
||||
// (execute some code...)
|
||||
// plProfile_EndTiming(FoobarTime);
|
||||
//
|
||||
// plProfile_BeginLap(FoobarTime, pKeyedObj->GetKeyName());
|
||||
// pKeyedObj->DoStuff();
|
||||
// plProfile_EndLap(FoobarTime, pKeyedObj->GetKeyName());
|
||||
// }
|
||||
//
|
||||
|
||||
#ifdef PL_PROFILE_ENABLED
|
||||
|
||||
#define plProfile_CreateTimerNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_CreateTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime)
|
||||
#define plProfile_CreateAsynchTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayResetEveryBegin | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_BeginTiming(varName) gProfileVar##varName.BeginTiming()
|
||||
#define plProfile_EndTiming(varName) gProfileVar##varName.EndTiming()
|
||||
#define plProfile_BeginLap(varName, lapName) gProfileVar##varName.BeginLap(lapName)
|
||||
#define plProfile_EndLap(varName, lapName) gProfileVar##varName.EndLap(lapName)
|
||||
|
||||
#define plProfile_CreateCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount)
|
||||
#define plProfile_CreateCounterNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_Inc(varName) gProfileVar##varName.Inc()
|
||||
#define plProfile_IncCount(varName, count) gProfileVar##varName.Inc(count)
|
||||
#define plProfile_Dec(varName) gProfileVar##varName.Dec()
|
||||
#define plProfile_Set(varName, value) gProfileVar##varName.Set(value)
|
||||
|
||||
#define plProfile_CreateMemCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_CreateMemCounterReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem)
|
||||
#define plProfile_NewMem(varName, memAmount) gProfileVar##varName.NewMem(memAmount)
|
||||
#define plProfile_DelMem(varName, memAmount) gProfileVar##varName.DelMem(memAmount)
|
||||
|
||||
#define plProfile_StopVar(varName) gProfileVar##varName.Stop()
|
||||
#define plProfile_StartVar(varName) gProfileVar##varName.Start()
|
||||
|
||||
#define plProfile_Extern(varName) extern plProfileVar gProfileVar##varName
|
||||
|
||||
#else
|
||||
|
||||
#define plProfile_CreateTimerNoReset(name, group, varName)
|
||||
#define plProfile_CreateTimer(name, group, varName)
|
||||
#define plProfile_CreateAsynchTimer(name, group, varName)
|
||||
#define plProfile_BeginTiming(varName)
|
||||
#define plProfile_EndTiming(varName)
|
||||
#define plProfile_BeginLap(varName, lapName)
|
||||
#define plProfile_EndLap(varName, lapName)
|
||||
|
||||
#define plProfile_CreateCounter(name, group, varName)
|
||||
#define plProfile_CreateCounterNoReset(name, group, varName)
|
||||
#define plProfile_Inc(varName)
|
||||
#define plProfile_IncCount(varName, count)
|
||||
#define plProfile_Dec(varName)
|
||||
#define plProfile_Set(varName, value)
|
||||
|
||||
#define plProfile_CreateMemCounter(name, group, varName)
|
||||
#define plProfile_CreateMemCounterReset(name, group, varName)
|
||||
#define plProfile_NewMem(varName, memAmount)
|
||||
#define plProfile_DelMem(varName, memAmount)
|
||||
|
||||
#define plProfile_StopVar(varName)
|
||||
#define plProfile_StartVar(varName)
|
||||
|
||||
#define plProfile_Extern(varName)
|
||||
|
||||
#endif
|
||||
|
||||
class plProfileLaps;
|
||||
|
||||
class plProfileBase
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kDisplayCount = 0x1,
|
||||
kDisplayTime = 0x2,
|
||||
kDisplayMem = 0x4,
|
||||
kDisplayNoReset = 0x8,
|
||||
kDisplayFPS = 0x10,
|
||||
kDisplayLaps = 0x20,
|
||||
kDisplaySelected = 0x40,
|
||||
kDisplayResetEveryBegin = 0x80
|
||||
};
|
||||
|
||||
protected:
|
||||
const char* fName; // Name of timer
|
||||
|
||||
UInt32 fValue;
|
||||
|
||||
UInt32 fAvgCount;
|
||||
UInt64 fAvgTotal;
|
||||
UInt32 fLastAvg;
|
||||
UInt32 fMax;
|
||||
hsBool fActive;
|
||||
hsBool fRunning;
|
||||
UInt8 fDisplayFlags;
|
||||
|
||||
// Number of times EndTiming was called. Can be used to combine timing and counting in one timer
|
||||
UInt32 fTimerSamples;
|
||||
|
||||
void IAddAvg();
|
||||
|
||||
void IPrintValue(UInt32 value, char* buf, hsBool printType);
|
||||
|
||||
public:
|
||||
plProfileBase();
|
||||
virtual ~plProfileBase();
|
||||
|
||||
virtual void BeginFrame();
|
||||
virtual void EndFrame();
|
||||
|
||||
void UpdateAvg();
|
||||
|
||||
UInt32 GetValue();
|
||||
|
||||
void PrintValue(char* buf, hsBool printType=true);
|
||||
void PrintAvg(char* buf, hsBool printType=true);
|
||||
void PrintMax(char* buf, hsBool printType=true);
|
||||
|
||||
UInt32 GetTimerSamples() const { return fTimerSamples; }
|
||||
|
||||
const char* GetName() { return fName; }
|
||||
|
||||
void SetActive(hsBool s) { fActive = s; }
|
||||
|
||||
void Stop() { fRunning = false; }
|
||||
void Start() { fRunning = true; }
|
||||
|
||||
UInt8 GetDisplayFlags() const { return fDisplayFlags; }
|
||||
|
||||
void ResetMax() { fMax = 0; }
|
||||
};
|
||||
|
||||
class plProfileVar : public plProfileBase
|
||||
{
|
||||
protected:
|
||||
const char* fGroup;
|
||||
plProfileLaps* fLaps;
|
||||
hsBool fLapsActive;
|
||||
|
||||
plProfileVar() {}
|
||||
|
||||
void IBeginTiming();
|
||||
void IEndTiming();
|
||||
|
||||
void IBeginLap(const char* lapName);
|
||||
void IEndLap(const char* lapName);
|
||||
|
||||
public:
|
||||
// Name is the timer name. Each timer group gets its own plStatusLog
|
||||
plProfileVar(const char *name, const char* group, UInt8 flags);
|
||||
~plProfileVar();
|
||||
|
||||
// For timing
|
||||
void BeginTiming() { if (fActive && fRunning) IBeginTiming(); }
|
||||
void EndTiming() { if (fActive && fRunning) IEndTiming(); }
|
||||
|
||||
void NewMem(UInt32 memAmount) { fValue += memAmount; }
|
||||
void DelMem(UInt32 memAmount) { fValue -= memAmount; }
|
||||
|
||||
// For Counting
|
||||
void Inc(int i = 1) { fValue += i;}
|
||||
void Dec(int i = 1) { fValue -= i;}
|
||||
|
||||
void Set(UInt32 value) { fValue = value; }
|
||||
|
||||
//
|
||||
// For multiple timings per frame of the same thing ie. Each particle system
|
||||
//
|
||||
// Will output to log like
|
||||
// Timername : lapCnt: (lapName) : 3.22 msec
|
||||
//
|
||||
void BeginLap(const char* lapName) { if(fActive && fRunning) IBeginLap(lapName); }
|
||||
void EndLap(const char* lapName) { if(fActive && fRunning) IEndLap(lapName); }
|
||||
|
||||
const char* GetGroup() { return fGroup; }
|
||||
|
||||
plProfileLaps* GetLaps() { return fLaps; }
|
||||
|
||||
// Enable Lap Sampling
|
||||
void SetLapsActive(hsBool s) { fLapsActive = s; }
|
||||
};
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfile_h_inc
|
||||
#define plProfile_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
#define PL_PROFILE_ENABLED
|
||||
#endif
|
||||
|
||||
//
|
||||
// These macros are all you should need to use to profile your code. They are
|
||||
// compiled out in external release mode for maximum performance.
|
||||
//
|
||||
// plProfile_Create* should only be used at global scope, not in functions.
|
||||
// Use plProfile_Extern if the plProfile_Create* for a variable is in another source file.
|
||||
//
|
||||
// --Examples--
|
||||
//
|
||||
// plProfile_CreateCounter("Num Foobars", "Test", NumFoobars);
|
||||
// void SomeFunc1()
|
||||
// {
|
||||
// plProfile_Inc(NumFoobars);
|
||||
// plProfile_IncCount(NumFoobars, 5);
|
||||
// }
|
||||
//
|
||||
// plProfile_CreateTimer("Foobar Time", "Test", FoobarTime);
|
||||
// void SomeFunc2()
|
||||
// {
|
||||
// plProfile_BeginTiming(FoobarTime);
|
||||
// (execute some code...)
|
||||
// plProfile_EndTiming(FoobarTime);
|
||||
//
|
||||
// plProfile_BeginLap(FoobarTime, pKeyedObj->GetKeyName());
|
||||
// pKeyedObj->DoStuff();
|
||||
// plProfile_EndLap(FoobarTime, pKeyedObj->GetKeyName());
|
||||
// }
|
||||
//
|
||||
|
||||
#ifdef PL_PROFILE_ENABLED
|
||||
|
||||
#define plProfile_CreateTimerNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_CreateTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime)
|
||||
#define plProfile_CreateAsynchTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayResetEveryBegin | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_BeginTiming(varName) gProfileVar##varName.BeginTiming()
|
||||
#define plProfile_EndTiming(varName) gProfileVar##varName.EndTiming()
|
||||
#define plProfile_BeginLap(varName, lapName) gProfileVar##varName.BeginLap(lapName)
|
||||
#define plProfile_EndLap(varName, lapName) gProfileVar##varName.EndLap(lapName)
|
||||
|
||||
#define plProfile_CreateCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount)
|
||||
#define plProfile_CreateCounterNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_Inc(varName) gProfileVar##varName.Inc()
|
||||
#define plProfile_IncCount(varName, count) gProfileVar##varName.Inc(count)
|
||||
#define plProfile_Dec(varName) gProfileVar##varName.Dec()
|
||||
#define plProfile_Set(varName, value) gProfileVar##varName.Set(value)
|
||||
|
||||
#define plProfile_CreateMemCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem | plProfileVar::kDisplayNoReset)
|
||||
#define plProfile_CreateMemCounterReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem)
|
||||
#define plProfile_NewMem(varName, memAmount) gProfileVar##varName.NewMem(memAmount)
|
||||
#define plProfile_DelMem(varName, memAmount) gProfileVar##varName.DelMem(memAmount)
|
||||
|
||||
#define plProfile_StopVar(varName) gProfileVar##varName.Stop()
|
||||
#define plProfile_StartVar(varName) gProfileVar##varName.Start()
|
||||
|
||||
#define plProfile_Extern(varName) extern plProfileVar gProfileVar##varName
|
||||
|
||||
#else
|
||||
|
||||
#define plProfile_CreateTimerNoReset(name, group, varName)
|
||||
#define plProfile_CreateTimer(name, group, varName)
|
||||
#define plProfile_CreateAsynchTimer(name, group, varName)
|
||||
#define plProfile_BeginTiming(varName)
|
||||
#define plProfile_EndTiming(varName)
|
||||
#define plProfile_BeginLap(varName, lapName)
|
||||
#define plProfile_EndLap(varName, lapName)
|
||||
|
||||
#define plProfile_CreateCounter(name, group, varName)
|
||||
#define plProfile_CreateCounterNoReset(name, group, varName)
|
||||
#define plProfile_Inc(varName)
|
||||
#define plProfile_IncCount(varName, count)
|
||||
#define plProfile_Dec(varName)
|
||||
#define plProfile_Set(varName, value)
|
||||
|
||||
#define plProfile_CreateMemCounter(name, group, varName)
|
||||
#define plProfile_CreateMemCounterReset(name, group, varName)
|
||||
#define plProfile_NewMem(varName, memAmount)
|
||||
#define plProfile_DelMem(varName, memAmount)
|
||||
|
||||
#define plProfile_StopVar(varName)
|
||||
#define plProfile_StartVar(varName)
|
||||
|
||||
#define plProfile_Extern(varName)
|
||||
|
||||
#endif
|
||||
|
||||
class plProfileLaps;
|
||||
|
||||
class plProfileBase
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kDisplayCount = 0x1,
|
||||
kDisplayTime = 0x2,
|
||||
kDisplayMem = 0x4,
|
||||
kDisplayNoReset = 0x8,
|
||||
kDisplayFPS = 0x10,
|
||||
kDisplayLaps = 0x20,
|
||||
kDisplaySelected = 0x40,
|
||||
kDisplayResetEveryBegin = 0x80
|
||||
};
|
||||
|
||||
protected:
|
||||
const char* fName; // Name of timer
|
||||
|
||||
UInt32 fValue;
|
||||
|
||||
UInt32 fAvgCount;
|
||||
UInt64 fAvgTotal;
|
||||
UInt32 fLastAvg;
|
||||
UInt32 fMax;
|
||||
hsBool fActive;
|
||||
hsBool fRunning;
|
||||
UInt8 fDisplayFlags;
|
||||
|
||||
// Number of times EndTiming was called. Can be used to combine timing and counting in one timer
|
||||
UInt32 fTimerSamples;
|
||||
|
||||
void IAddAvg();
|
||||
|
||||
void IPrintValue(UInt32 value, char* buf, hsBool printType);
|
||||
|
||||
public:
|
||||
plProfileBase();
|
||||
virtual ~plProfileBase();
|
||||
|
||||
virtual void BeginFrame();
|
||||
virtual void EndFrame();
|
||||
|
||||
void UpdateAvg();
|
||||
|
||||
UInt32 GetValue();
|
||||
|
||||
void PrintValue(char* buf, hsBool printType=true);
|
||||
void PrintAvg(char* buf, hsBool printType=true);
|
||||
void PrintMax(char* buf, hsBool printType=true);
|
||||
|
||||
UInt32 GetTimerSamples() const { return fTimerSamples; }
|
||||
|
||||
const char* GetName() { return fName; }
|
||||
|
||||
void SetActive(hsBool s) { fActive = s; }
|
||||
|
||||
void Stop() { fRunning = false; }
|
||||
void Start() { fRunning = true; }
|
||||
|
||||
UInt8 GetDisplayFlags() const { return fDisplayFlags; }
|
||||
|
||||
void ResetMax() { fMax = 0; }
|
||||
};
|
||||
|
||||
class plProfileVar : public plProfileBase
|
||||
{
|
||||
protected:
|
||||
const char* fGroup;
|
||||
plProfileLaps* fLaps;
|
||||
hsBool fLapsActive;
|
||||
|
||||
plProfileVar() {}
|
||||
|
||||
void IBeginTiming();
|
||||
void IEndTiming();
|
||||
|
||||
void IBeginLap(const char* lapName);
|
||||
void IEndLap(const char* lapName);
|
||||
|
||||
public:
|
||||
// Name is the timer name. Each timer group gets its own plStatusLog
|
||||
plProfileVar(const char *name, const char* group, UInt8 flags);
|
||||
~plProfileVar();
|
||||
|
||||
// For timing
|
||||
void BeginTiming() { if (fActive && fRunning) IBeginTiming(); }
|
||||
void EndTiming() { if (fActive && fRunning) IEndTiming(); }
|
||||
|
||||
void NewMem(UInt32 memAmount) { fValue += memAmount; }
|
||||
void DelMem(UInt32 memAmount) { fValue -= memAmount; }
|
||||
|
||||
// For Counting
|
||||
void Inc(int i = 1) { fValue += i;}
|
||||
void Dec(int i = 1) { fValue -= i;}
|
||||
|
||||
void Set(UInt32 value) { fValue = value; }
|
||||
|
||||
//
|
||||
// For multiple timings per frame of the same thing ie. Each particle system
|
||||
//
|
||||
// Will output to log like
|
||||
// Timername : lapCnt: (lapName) : 3.22 msec
|
||||
//
|
||||
void BeginLap(const char* lapName) { if(fActive && fRunning) IBeginLap(lapName); }
|
||||
void EndLap(const char* lapName) { if(fActive && fRunning) IEndLap(lapName); }
|
||||
|
||||
const char* GetGroup() { return fGroup; }
|
||||
|
||||
plProfileLaps* GetLaps() { return fLaps; }
|
||||
|
||||
// Enable Lap Sampling
|
||||
void SetLapsActive(hsBool s) { fLapsActive = s; }
|
||||
};
|
||||
|
||||
#endif // plProfile_h_inc
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +1,96 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfileManager_h_inc
|
||||
#define plProfileManager_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "plProfile.h"
|
||||
|
||||
class plProfileManager
|
||||
{
|
||||
protected:
|
||||
friend class plProfileManagerFull;
|
||||
|
||||
typedef std::vector<plProfileVar*> VarVec;
|
||||
VarVec fVars;
|
||||
|
||||
double fLastAvgTime;
|
||||
|
||||
UInt32 fProcessorSpeed;
|
||||
|
||||
plProfileManager();
|
||||
|
||||
public:
|
||||
~plProfileManager();
|
||||
|
||||
static plProfileManager& Instance();
|
||||
|
||||
void AddTimer(plProfileVar* var); // Called by plProfileVar
|
||||
|
||||
void BeginFrame(); // Call begin frame on all timers
|
||||
void EndFrame(); // Call end frame on all timers
|
||||
|
||||
void SetAvgTime(UInt32 avgMS);
|
||||
|
||||
UInt32 GetProcessorSpeed() { return fProcessorSpeed; }
|
||||
|
||||
// Backdoor for hack timers in calculated profiles
|
||||
static UInt32 GetTime();
|
||||
};
|
||||
|
||||
class plProfileLaps
|
||||
{
|
||||
protected:
|
||||
class LapInfo : public plProfileBase
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
bool fUsedThisFrame;
|
||||
LapInfo(const char* name) { fName = name; fDisplayFlags = kDisplayTime; }
|
||||
bool operator<(const LapInfo& rhs) const { return fLastAvg < rhs.fLastAvg; }
|
||||
|
||||
void BeginTiming(UInt32 value) { fValue -= value; }
|
||||
void EndTiming(UInt32 value) { fValue += value; fTimerSamples++; }
|
||||
};
|
||||
std::vector<LapInfo> fLapTimes;
|
||||
|
||||
LapInfo* IFindLap(const char* lapName);
|
||||
|
||||
public:
|
||||
void BeginLap(UInt32 curValue, const char* name);
|
||||
void EndLap(UInt32 curValue, const char* name);
|
||||
|
||||
void BeginFrame();
|
||||
void EndFrame();
|
||||
void UpdateAvgs();
|
||||
|
||||
int GetNumLaps();
|
||||
plProfileBase* GetLap(int i);
|
||||
};
|
||||
|
||||
#endif // plProfileManager_h_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plProfileManager_h_inc
|
||||
#define plProfileManager_h_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "plProfile.h"
|
||||
|
||||
class plProfileManager
|
||||
{
|
||||
protected:
|
||||
friend class plProfileManagerFull;
|
||||
|
||||
typedef std::vector<plProfileVar*> VarVec;
|
||||
VarVec fVars;
|
||||
|
||||
double fLastAvgTime;
|
||||
|
||||
UInt32 fProcessorSpeed;
|
||||
|
||||
plProfileManager();
|
||||
|
||||
public:
|
||||
~plProfileManager();
|
||||
|
||||
static plProfileManager& Instance();
|
||||
|
||||
void AddTimer(plProfileVar* var); // Called by plProfileVar
|
||||
|
||||
void BeginFrame(); // Call begin frame on all timers
|
||||
void EndFrame(); // Call end frame on all timers
|
||||
|
||||
void SetAvgTime(UInt32 avgMS);
|
||||
|
||||
UInt32 GetProcessorSpeed() { return fProcessorSpeed; }
|
||||
|
||||
// Backdoor for hack timers in calculated profiles
|
||||
static UInt32 GetTime();
|
||||
};
|
||||
|
||||
class plProfileLaps
|
||||
{
|
||||
protected:
|
||||
class LapInfo : public plProfileBase
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
bool fUsedThisFrame;
|
||||
LapInfo(const char* name) { fName = name; fDisplayFlags = kDisplayTime; }
|
||||
bool operator<(const LapInfo& rhs) const { return fLastAvg < rhs.fLastAvg; }
|
||||
|
||||
void BeginTiming(UInt32 value) { fValue -= value; }
|
||||
void EndTiming(UInt32 value) { fValue += value; fTimerSamples++; }
|
||||
};
|
||||
std::vector<LapInfo> fLapTimes;
|
||||
|
||||
LapInfo* IFindLap(const char* lapName);
|
||||
|
||||
public:
|
||||
void BeginLap(UInt32 curValue, const char* name);
|
||||
void EndLap(UInt32 curValue, const char* name);
|
||||
|
||||
void BeginFrame();
|
||||
void EndFrame();
|
||||
void UpdateAvgs();
|
||||
|
||||
int GetNumLaps();
|
||||
plProfileBase* GetLap(int i);
|
||||
};
|
||||
|
||||
#endif // plProfileManager_h_inc
|
||||
|
@ -1,37 +1,37 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plRefFlags_inc
|
||||
#define plRefFlags_inc
|
||||
|
||||
namespace plRefFlags
|
||||
{
|
||||
enum Type {
|
||||
kActiveRef, // If one is resident, return it, else create and load one to return. Keep it loaded till I release.
|
||||
kPassiveRef // Just notify me when it is loaded or unloaded until I release.
|
||||
};
|
||||
};
|
||||
|
||||
#endif // plRefFlags_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plRefFlags_inc
|
||||
#define plRefFlags_inc
|
||||
|
||||
namespace plRefFlags
|
||||
{
|
||||
enum Type {
|
||||
kActiveRef, // If one is resident, return it, else create and load one to return. Keep it loaded till I release.
|
||||
kPassiveRef // Just notify me when it is loaded or unloaded until I release.
|
||||
};
|
||||
};
|
||||
|
||||
#endif // plRefFlags_inc
|
||||
|
@ -1,65 +1,65 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plDispatchBase_inc
|
||||
#define plDispatchBase_inc
|
||||
|
||||
#include "pnFactory/plCreatable.h"
|
||||
|
||||
class plMessage;
|
||||
class plKey;
|
||||
|
||||
class plDispatchBase : public plCreatable
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER( plDispatchBase );
|
||||
GETINTERFACE_ANY( plDispatchBase, plCreatable );
|
||||
|
||||
virtual void RegisterForType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
virtual void RegisterForExactType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
|
||||
virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
virtual void UnRegisterForExactType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
|
||||
virtual void UnRegisterAll(const plKey& receiver) = 0;
|
||||
|
||||
virtual hsBool MsgSend(plMessage* msg, hsBool async=false) = 0;
|
||||
virtual void MsgQueue(plMessage* msg)=0; // Used by other thread to Send Messages, they are handled as soon as Practicable
|
||||
virtual void MsgQueueProcess() = 0;
|
||||
virtual void MsgQueueOnOff(hsBool) = 0; // Turn on or off Queued Messages, if off, uses MsgSend Immediately (for plugins)
|
||||
|
||||
virtual hsBool SetMsgBuffering(hsBool on) = 0; // On starts deferring msg delivery until buffering is set to off again.
|
||||
};
|
||||
|
||||
class plgDispatch
|
||||
{
|
||||
public:
|
||||
static plDispatchBase* Dispatch();
|
||||
static hsBool MsgSend(plMessage* msg, hsBool async = false) { return Dispatch()->MsgSend(msg, async); }
|
||||
};
|
||||
|
||||
|
||||
#endif // plDispatchBase_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plDispatchBase_inc
|
||||
#define plDispatchBase_inc
|
||||
|
||||
#include "pnFactory/plCreatable.h"
|
||||
|
||||
class plMessage;
|
||||
class plKey;
|
||||
|
||||
class plDispatchBase : public plCreatable
|
||||
{
|
||||
public:
|
||||
CLASSNAME_REGISTER( plDispatchBase );
|
||||
GETINTERFACE_ANY( plDispatchBase, plCreatable );
|
||||
|
||||
virtual void RegisterForType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
virtual void RegisterForExactType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
|
||||
virtual void UnRegisterForType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
virtual void UnRegisterForExactType(UInt16 hClass, const plKey& receiver) = 0;
|
||||
|
||||
virtual void UnRegisterAll(const plKey& receiver) = 0;
|
||||
|
||||
virtual hsBool MsgSend(plMessage* msg, hsBool async=false) = 0;
|
||||
virtual void MsgQueue(plMessage* msg)=0; // Used by other thread to Send Messages, they are handled as soon as Practicable
|
||||
virtual void MsgQueueProcess() = 0;
|
||||
virtual void MsgQueueOnOff(hsBool) = 0; // Turn on or off Queued Messages, if off, uses MsgSend Immediately (for plugins)
|
||||
|
||||
virtual hsBool SetMsgBuffering(hsBool on) = 0; // On starts deferring msg delivery until buffering is set to off again.
|
||||
};
|
||||
|
||||
class plgDispatch
|
||||
{
|
||||
public:
|
||||
static plDispatchBase* Dispatch();
|
||||
static hsBool MsgSend(plMessage* msg, hsBool async = false) { return Dispatch()->MsgSend(msg, async); }
|
||||
};
|
||||
|
||||
|
||||
#endif // plDispatchBase_inc
|
||||
|
@ -1,33 +1,33 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pnAllCreatables_inc
|
||||
#define pnAllCreatables_inc
|
||||
|
||||
#include "pnNucleusCreatables.h"
|
||||
#include "../../Apps/plClient/plClientCreatable.h"
|
||||
|
||||
#endif // pnAllCreatables_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pnAllCreatables_inc
|
||||
#define pnAllCreatables_inc
|
||||
|
||||
#include "pnNucleusCreatables.h"
|
||||
#include "../../Apps/plClient/plClientCreatable.h"
|
||||
|
||||
#endif // pnAllCreatables_inc
|
||||
|
@ -1,56 +1,56 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pnNucleusCreatables_inc
|
||||
#define pnNucleusCreatables_inc
|
||||
|
||||
#include "pnFactory/plCreator.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plPipeline );
|
||||
|
||||
#include "plAudible.h"
|
||||
REGISTER_NONCREATABLE( plAudible );
|
||||
|
||||
#include "plDrawable.h"
|
||||
REGISTER_NONCREATABLE( plDrawable );
|
||||
|
||||
#include "plPhysical.h"
|
||||
REGISTER_NONCREATABLE( plPhysical );
|
||||
|
||||
#include "plgDispatch.h"
|
||||
REGISTER_NONCREATABLE( plDispatchBase );
|
||||
|
||||
#include "../pnDispatch/pnDispatchCreatable.h"
|
||||
#include "../pnKeyedObject/pnKeyedObjectCreatable.h"
|
||||
#include "../pnMessage/pnMessageCreatable.h"
|
||||
#include "../pnModifier/pnModifierCreatable.h"
|
||||
#include "../pnNetCommon/pnNetCommonCreatable.h"
|
||||
#include "../pnSceneObject/pnSceneObjectCreatable.h"
|
||||
#include "../pnTimer/pnTimerCreatable.h"
|
||||
|
||||
#endif // pnNucleusCreatables_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pnNucleusCreatables_inc
|
||||
#define pnNucleusCreatables_inc
|
||||
|
||||
#include "pnFactory/plCreator.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plPipeline );
|
||||
|
||||
#include "plAudible.h"
|
||||
REGISTER_NONCREATABLE( plAudible );
|
||||
|
||||
#include "plDrawable.h"
|
||||
REGISTER_NONCREATABLE( plDrawable );
|
||||
|
||||
#include "plPhysical.h"
|
||||
REGISTER_NONCREATABLE( plPhysical );
|
||||
|
||||
#include "plgDispatch.h"
|
||||
REGISTER_NONCREATABLE( plDispatchBase );
|
||||
|
||||
#include "../pnDispatch/pnDispatchCreatable.h"
|
||||
#include "../pnKeyedObject/pnKeyedObjectCreatable.h"
|
||||
#include "../pnMessage/pnMessageCreatable.h"
|
||||
#include "../pnModifier/pnModifierCreatable.h"
|
||||
#include "../pnNetCommon/pnNetCommonCreatable.h"
|
||||
#include "../pnSceneObject/pnSceneObjectCreatable.h"
|
||||
#include "../pnTimer/pnTimerCreatable.h"
|
||||
|
||||
#endif // pnNucleusCreatables_inc
|
||||
|
@ -1,68 +1,68 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "plgDispatch.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "plPipeResReq.h"
|
||||
|
||||
hsResMgr* hsgResMgr::fResMgr = nil;
|
||||
|
||||
plDispatchBase* plgDispatch::Dispatch()
|
||||
{
|
||||
return hsgResMgr::Dispatch();
|
||||
}
|
||||
|
||||
hsBool hsgResMgr::Init(hsResMgr* m)
|
||||
{
|
||||
hsRefCnt_SafeAssign(fResMgr, m);
|
||||
hsRefCnt_SafeUnRef(m);
|
||||
if (!m->IInit())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void hsgResMgr::Shutdown()
|
||||
{
|
||||
if (fResMgr)
|
||||
{
|
||||
if (fResMgr->RefCnt() <= 1)
|
||||
{
|
||||
fResMgr->IShutdown();
|
||||
hsRefCnt_SafeUnRef(fResMgr);
|
||||
fResMgr = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsRefCnt_SafeUnRef(fResMgr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plPipeResReq& plPipeResReq::Instance()
|
||||
{
|
||||
static plPipeResReq r;
|
||||
return r;
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "plgDispatch.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "plPipeResReq.h"
|
||||
|
||||
hsResMgr* hsgResMgr::fResMgr = nil;
|
||||
|
||||
plDispatchBase* plgDispatch::Dispatch()
|
||||
{
|
||||
return hsgResMgr::Dispatch();
|
||||
}
|
||||
|
||||
hsBool hsgResMgr::Init(hsResMgr* m)
|
||||
{
|
||||
hsRefCnt_SafeAssign(fResMgr, m);
|
||||
hsRefCnt_SafeUnRef(m);
|
||||
if (!m->IInit())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void hsgResMgr::Shutdown()
|
||||
{
|
||||
if (fResMgr)
|
||||
{
|
||||
if (fResMgr->RefCnt() <= 1)
|
||||
{
|
||||
fResMgr->IShutdown();
|
||||
hsRefCnt_SafeUnRef(fResMgr);
|
||||
fResMgr = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsRefCnt_SafeUnRef(fResMgr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plPipeResReq& plPipeResReq::Instance()
|
||||
{
|
||||
static plPipeResReq r;
|
||||
return r;
|
||||
}
|
||||
|
Reference in New Issue
Block a user