Skip to content
Snippets Groups Projects
Select Git revision
  • 5e40943997f91f999220b18dec11a7aa3b19d861
  • branchX default protected
  • Inventory
  • UIControls
  • fsv2
  • tonetest
  • from_nb
  • tonemapping
  • opt-shadows
  • BX-634
  • xCSG
  • hc
  • gizmos
  • gui2CSSLexer
  • msExporter
  • gui2
  • gui2Fix
  • master protected
  • pk
  • mesh_optimize
  • light_wip
  • version_X.11.2 protected
  • version_X.11.1 protected
  • version_X.11.1-dev protected
  • version_X.11.0-dev protected
  • version_X.10.1 protected
  • version_X.10.1-dev protected
  • version_X.10.0-dev protected
  • version_X.9.5 protected
  • version_X.9.4 protected
  • version_X.9.3 protected
  • version_X.9.3-dev protected
  • version_X.9.2-dev protected
  • version_X.9.1-dev protected
  • version_X.9.0-dev protected
  • version_X.8.2 protected
  • version_X.8.2-dev protected
  • version_X.8.1-dev protected
  • version_X.8.0-dev protected
  • version_X.7.1 protected
  • version_X.7.0 protected
41 results

DynamicModelShared.h

Blame
  • DynamicModelShared.h 2.83 KiB
    #ifndef __DYNAMICMODELSHARED_H
    #define __DYNAMICMODELSHARED_H
    
    #include <xcommon/resource/IXModelProvider.h>
    #include <graphix/graphix.h>
    #include <mtrl/IXMaterial.h>
    
    class CDynamicModelProvider;
    class IXMaterialSystem;
    
    #define MAX_INSTANCES 32
    
    class CDynamicModelShared
    {
    public:
    	SX_ALIGNED_OP_MEM2();
    
    	CDynamicModelShared(CDynamicModelProvider *pProvider);
    	~CDynamicModelShared();
    	void AddRef();
    	void Release();
    
    	bool init(IXResourceModelStatic *pResource);
    
    	IXResourceModelStatic *getResource();
    
    	UINT getPhysboxCount() const;
    	const IModelPhysbox *getPhysBox(UINT id) const;
    
    	float3 getLocalBoundMin() const;
    	float3 getLocalBoundMax() const;
    	SMAABB getLocalBound() const;
    
    	void render(UINT uSkin, UINT uLod, const float4_t &vColor, XMODEL_FEATURE bmFeatures);
    	void renderInstanced(const float3 &vPos, const SMQuaternion &qRot, float fScale, const float4_t &vColor);
    
    	void initGPUresources();
    	bool isReady() const;
    
    	XMODEL_FEATURE getFeatures(UINT uSkin, UINT uLod);
    	IXMaterial* getTransparentMaterial(UINT uSkin, UINT uLod);
    
    	void onMaterialTransparencyChanged(const IXMaterial *pMaterial);
    	void onMaterialEmissivityChanged(const IXMaterial *pMaterial);
    	float3 getTransparentBoundMin(UINT uSkin, UINT uLod) const;
    	float3 getTransparentBoundMax(UINT uSkin, UINT uLod) const;
    
    	const Array<float4_t>& getPSPs(UINT uSkin, UINT uLod) const;
    
    	void beginInstancing(UINT uSkin, UINT uLod, XMODEL_FEATURE bmWhat);
    	void endInstancing();
    	bool isInstancing();
    
    protected:
    	void buildPSPs();
    
    protected:
    	//! todo: make it atomic
    	UINT m_uRefCount = 1;
    	IXResourceModelStatic *m_pResource = NULL;
    
    	IGXRenderBuffer **m_ppRenderBuffer = NULL;
    	IGXIndexBuffer **m_ppIndexBuffer = NULL;
    
    	UINT **m_ppTempIndices = NULL;
    	XResourceModelStaticVertex **m_ppTempVertices = NULL;
    	UINT *m_puTempTotalIndices = 0;
    	UINT *m_puTempTotalVertices = 0;
    
    	CDynamicModelProvider *m_pProvider;