|
|
属某地政府出资引进。提供详细证据证明决非虚假。
关键部分每块最低5位数价格。
大家应该都知道引擎采用的是目前最先进的技术啦。如sm3.0,hdr.性价比同2002年的unrealengine2相比不用我说了吧。
仅供个人学习,以促进中国游戏开发水平,严禁用于商业目的!
请不要故意捣乱。
qq:362982728
代码数量庞大。13个模块。带详细的注解(请看2)
CrySystem
Cry3DEngine
XRender
CryScriptSystem
CrySoundSystem
CryNetworkSystem
CryInputSystem
CryEntitySystem
CryAISystem
CryGame
CryPhysics
CryAnimation
CryConfig
以下贴出一点:
1,此XrenderD3D接口。因为属关键部分,注释和部分行删去
class CryXDeviceD3d : public CryDevice {
static EGxTexFormat stolerableTexFmtMapping[8];
static D3DFORMAT sGxTexFmtToD3dFmt[8];
static EGxTexFormat sGxTexFmtToUse[8];
static D3DCUBEMAPFACES sd3dCubeMapFaces[6];
static D3DFORMAT sGxFormatToD3dFormat[8];
static CryDeviceD3d* mthisDevice;
struct HWND* mhwnd;
unsigned short mhwndClass;
int mownhwnd;
struct HINSTANCE* md3dLib;
struct IDirect3D9* md3d;
struct IDirect3DDevice9* md3dDevice;
struct D3DCAPS9 md3dCaps;
int md3dIsHwDevice;
int md3dNeedsReset;
class CVertexBufferList mVBL[4][9];
class CryIndexBufferD3d* mIB[4][9];
class CryVertexBufferD3d* mvertexBuffer;
enum EGxPrim mprimType;
unsigned int mprimIndexCount;;
int mprocessedIndexPtrs;
int mwindowVisible;
struct D3DDISPLAYMODE mdesktopDisplayMode;
int mdeviceSupports32BitTextures;
int minScene;
enum D3DFORMAT mdevDepthFormat;
enum D3DFORMAT mdevAdapterFormat;
struct IDirect3DSurface9* mrttDepthSurface;
struct IDirect3DSurface9* mdefColorSurface;
struct IDirect3DSurface9* mdefDepthSurface;
struct CryDeviceD3d::StateD3dLight md3dStatesLight[8];
unsigned long mdeviceState[34];
unsigned char mtexEnable[4];
static class CryDeviceD3d* GetDevice();
static int CryDeviceD3d::ILoadD3dLib( struct HINSTANCE*& d3dLib, struct IDirect3D9*& d3d);
static void CryDeviceD3d::IUnloadD3dLib( struct HINSTANCE*& d3dLib, struct IDirect3D9*& d3d);
static long CryDeviceD3d::WindowProcD3d( struct HWND* hWnd, unsigned int uMsg, unsigned int wParam, long lParam);
void CryDeviceD3d::CryDeviceD3d();
void CryDeviceD3d(class CryDeviceD3d&);
class CryDeviceD3d& operator=(class CryDeviceD3d&);
enum D3DFORMAT IDepthStencilBitsToFormat(unsigned int, unsigned int);
enum D3DFORMAT IColorAlphaBitsToFormat(unsigned int, unsigned int);
int CryDeviceD3d::ICreateD3d();
void CryDeviceD3d::IDestroyD3d();
int CryDeviceD3d::ICreateD3dDevice( struct CryFormat& format);
void CryDeviceD3d::IDestroyD3dDevice();
void CryDeviceD3d::ISetPresentParms( struct D3DPRESENTPARAMETERS& d3dpp, struct CryFormat& format);
void CryDeviceD3d::IReleaseD3dResources( int freeTextures);
void CryDeviceD3d::IPrimSetupPos( void* dstBuf);
int CryDeviceD3d::IAllocBuffers();
void CryDeviceD3d::ICreateBuffers( enum EGxVertexBufferFormat vbFormat, unsigned int numVertices, class CVertexBufferList& vbl, unsigned int numIndices, class CryIndexBufferD3d*& ib);
void CryDeviceD3d::ICreateD3dVB( enum EGxVertexBufferFormat format, unsigned int& numVertices, struct IDirect3DVertexBuffer9*& vb);
void CryDeviceD3d::ICreateD3dIB( unsigned int& numIndices, struct IDirect3DIndexBuffer9*& ib);
void CryDeviceD3d::IReleaseD3dVB( struct IDirect3DVertexBuffer9*& vb);
void CryDeviceD3d::IReleaseD3dIB( struct IDirect3DIndexBuffer9*& ib);
void CryDeviceD3d::IStateSync();
void CryDeviceD3d::IStateSyncLights();
void CryDeviceD3d::ISetLight( unsigned long which, struct D3DLIGHT9& value, int enabled);
void CryDeviceD3d::IForceLights();
void CryDeviceD3d::ITexForceRecreation( int freeTextures);
void CryDeviceD3d::IShaderForceRecreation( int freeShaders);
void CryDeviceD3d::ISceneBegin( unsigned int mask);
void CryDeviceD3d::ISceneEnd();
void CryDeviceD3d::IBufSetBuffers( class CryBufD3d* buf);
int CryDeviceD3d::ICheckTextureFormat( unsigned long usage, enum D3DFORMAT textureFormat);
void CryDeviceD3d::ISetCaps();
void CryDeviceD3d::ISetTexture( unsigned int tmu, class CryTex* tex);
void CryDeviceD3d::ISetTexGen( unsigned int tmu, enum EGxTexGen texGen);
void CryDeviceD3d::ISetTexLodBias( unsigned int tmu, float bias);
void CryDeviceD3d::ISetTexBlend( unsigned int tmu, enum EGxTexBlend blend);
void CryDeviceD3d::ITexCreate( class CryTex* gxTex, unsigned int w, unsigned int h, unsigned int startLevel, unsigned int endLevel);
void CryDeviceD3d::ITexUpload( class CryTex* texId, unsigned int w, unsigned int h, unsigned int startLevel, unsigned int endLevel);
void CryDeviceD3d::IXformSetWorld();
void CryDeviceD3d::IBindVertexShader( class CryVertexShader* vs);
void CryDeviceD3d::IPixelShaderCreate( class CryPixelShader* ps);
void CryDeviceD3d: sSet( enum CryDeviceD3d::EDeviceState state, unsigned long val);
unsigned long DsGet(enum CryDeviceD3d::EDeviceState);
virtual void CryDeviceD3d::ITexMarkAsUpdated( class CryTex* texId);
virtual void CryDeviceD3d::ISetShaderParamList( class TSExplicitList<CryShaderParam,108>& params, int forceForBind);
virtual void CryDeviceD3d::~CryDeviceD3d();
virtual int CryDeviceD3d::DeviceCreate( unsigned int hwnd, struct CryFormat& format);
virtual int CryDeviceD3d::DeviceCreate( long (windowProc*)(void*, unsigned int, unsigned int, long), struct CryFormat& format);
virtual void CryDeviceD3d::DeviceDestroy();
virtual int CryDeviceD3d::DeviceSetFormat( struct CryFormat& format);
virtual void CryDeviceD3d::DeviceSetBaseMipLevel( unsigned int baseMipLevel);
virtual void CryDeviceD3d::DeviceSetGamma( struct CryGammaRamp& ramp);
virtual void CryDeviceD3d::DeviceSetGamma( float gamma);
virtual void CryDeviceD3d::DeviceSetTextureQuality( int force32);
virtual unsigned long CryDeviceD3d::DeviceWindow();
virtual void CryDeviceD3d::DeviceReadPixels( class CiRect& rect, class TSGrowableArray<CImVector>& pixels);
virtual void CryDeviceD3d::DeviceReadDepths( class CiRect& rect, class TSGrowableArray<float>& depths);
virtual void CryDeviceD3d::DeviceWM( enum EGxWM wm, long param1, long param2);
virtual void CryDeviceD3d::DeviceSetRenderTarget( enum EGxBuffer buffer, class CryTex* gxTex, unsigned int plane);
virtual void CryDeviceD3d::DeviceOverride( enum EGxOverride override, unsigned long value);
virtual void CryDeviceD3d::CapsWindowSize( class CRect& dst);
virtual void CryDeviceD3d::XformSetProjection( class C44Matrix& matrix);
virtual void CryDeviceD3d::XformSetView( class C44Matrix& matrix);
virtual void CryDeviceD3d: rimLockAndProcessVertexPtrs( unsigned int vertexCount, class C3Vector* pos, unsigned int posStride, class C3Vector* normal, unsigned int normalStride, class CImVector* color, unsigned int colorStride, unsigned char* bone, unsigned int boneStride, class C2Vector* tex0, unsigned int tex0Stride, class C2Vector* tex1, unsigned int tex1Stride);
virtual void CryDeviceD3d::PrimDrawElements();
virtual void CryDeviceD3d::BufLock( struct CryBuf* b);
virtual void CryDeviceD3d::BufRender( struct CryBatch* batches, unsigned int count);
virtual void CryDeviceD3d::BufUnlock();
virtual void CryDeviceD3d::BufDestroy( struct CryBuf*& b);
virtual void CryDeviceD3d::BufReserve( enum EGxBufWriteFreq freq, enum EGxVertexBufferFormat format, unsigned int numVertices, unsigned int numIndices);
virtual int CryDeviceD3d::TexCreate( enum EGxTexTarget target, unsigned int width, unsigned int height, unsigned int depth, enum EGxTexFormat format, enum EGxTexFormat dataFormat, struct CryTexFlags flags, void* userArg, void (userFunc*)(enum EGxTexCommand, unsigned int, unsigned int, unsigned int, unsigned int, void*, unsigned int&, void*&), class CryTex*& texId);
enum EGxTexCommand, unsigned int, unsigned int, unsigned int, unsigned int, void*, unsigned int&, void*&), class CryTex*& texId);
virtual void CryDeviceD3d::TexDestroy( class CryTex* texId);
virtual void CryDeviceD3d::PixelShaderCreate( class CryPixelShader*& ps, char* filename);
virtual void CryDeviceD3d::PixelShaderDestroy( class CryPixelShader*& ps);
};
2,
class CryBoneDesc: public CryBoneDescData
{
public:
CryBoneDesc ();
~CryBoneDesc ();
// returns the bone name, if available
const char* getNameCStr()const;
const string& getName()const;
unsigned getControllerId()const {return m_nControllerID;}
// sets the name of the bone out of the given buffer of the given max size
void setName (const char* szName);
unsigned numChildren ()const {return m_numChildren;}
bool hasParent() const {return m_nOffsetParent != 0;}
int getParentIndexOffset()const {return m_nOffsetParent;}
int getFirstChildIndexOffset() const {return m_nOffsetChildren;}
const Matrix44& getInvDefGlobal() const {return m_matInvDefGlobal;}
void setDefaultGlobal(const Matrix44& mxDefault);
int getLimbId () const {return m_nLimbId;}
BONE_PHYSICS& getPhysInfo (int nLod) {return m_PhysInfo[nLod];}
// updates this bone physics, from the given entity descriptor, and of the given lod
void UpdatePhysics (const BONE_ENTITY& entity, int nLod);
void setPhysics (int nLod, const BONE_PHYSICS& BonePhysics)
{
assert (nLod >= 0 && nLod < sizeof(m_PhysInfo)/sizeof(m_PhysInfo[0]));
m_PhysInfo[nLod] = BonePhysics;
}
// the physics for the given LOD is not available
void resetPhysics (int nLod)
{
assert (nLod >= 0 && nLod < sizeof(m_PhysInfo)/sizeof(m_PhysInfo[0]));
memset (&m_PhysInfo[nLod], 0, sizeof(m_PhysInfo[nLod]));
}
const BONE_PHYSICS& getPhysics (int nLod)const
{
assert (nLod >= 0 && nLod < sizeof(m_PhysInfo)/sizeof(m_PhysInfo[0]));
return m_PhysInfo[nLod];
}
// Returns the id of the bone mesh chunk from which the bone physical geometry
// should be taken. The caller should take this id, find the corresponding chunk in the CCG/CGF file
// and construct physical geometry using IGeomManager::CreateMesh.
// Then, register it with RegisterGeometry(). It will return phys_geometry* that the caller
// should put into the corresponding LOD m_PhysInfo.pPhysGeom
// CryBoneInfo::PostInitPhysGeom uses this same id to find the physical geometry in the map
INT_PTR getPhysGeomId (unsigned nLOD) {return (INT_PTR)m_PhysInfo[nLOD].pPhysGeom;}
// compares two bone descriptions and returns true if they're the same bone
// (the same name and the same position in the hierarchy)
bool isEqual(const CryBoneDesc& desc)const;
// Serializes the description:
// returns the number of required bytes for serialization, if the data pointer is NULL
// returns 0 (if the buffer size is not enough) or the number of bytes written, if the data pointer is given
unsigned Serialize (bool bSave, void *pStream, unsigned nSize);
// scales the bone with the given multiplier
void scale (float fScale);
protected:
// loads the bone from a raw chunk data (no header)
// returns false if the bone couldn't be loaded
bool LoadRaw (const BONE_ENTITY* pEntity);
//! Performs post-initialization. This step is requred to initialize the pPhysGeom of the bones
//! After the bone has been loaded but before it is first used. When the bone is first loaded, pPhysGeom
//! is set to the value equal to the chunk id in the file where the physical geometry (BoneMesh) chunk is kept.
//! After those chunks are loaded, and chunk ids are mapped to the registered physical geometry objects,
//! call this function to replace pPhysGeom chunk ids with the actual physical geometry object pointers.
//! NOTE:
//! The entries of the map that were used are deleted
typedef std::map<INT_PTR, struct phys_geometry*> ChunkIdToPhysGeomMap;
bool PostInitPhysGeom (ChunkIdToPhysGeomMap& mapChunkIdToPhysGeom, int nLodLevel);
friend class CryBoneHierarchyLoader;
protected:
string m_strName;
};
#endif
|
|