Game Development Reference
In-Depth Information
'
'
There
t seen
before. This is the first time that VDiscardRawBufferAfterLoad() has returned
false. Here
s one subtle thing about the resource loaded code above that you haven
s why: the CDXUTSDKMesh class refers to the raw bits in the mesh, so if
they were discarded after the resource was loaded, the mesh would have invalid data
in it. It just goes to show that not every DXUT class or any SDK class from any ven-
dor out there operates similarly to others in the same library!
Meet the D3DShaderMeshNode11 class:
'
class D3DShaderMeshNode11 : public SceneNode
{
public:
D3DShaderMeshNode11(const ActorId actorId,
std::string name,
std::string sdkMeshFileName,
RenderPass renderPass,
const Color &color,
const Mat4x4 *t)
: SceneNode(actorId, name, renderPass, diffuseColor, t),
m_PixelShader(
““
)
{
m_sdkMeshFileName = sdkMeshFileName;
}
virtual ~D3DShaderMeshNode11();
virtual HRESULT VOnRestore(Scene *pScene);
virtual HRESULT VOnLostDevice(Scene *pScene) { return S_OK; }
virtual HRESULT VRender(Scene *pScene);
protected:
std::string m_sdkMeshFileName;
GameCode4_Hlsl_VertexShader
m_VertexShader;
GameCode4_Hlsl_PixelShader
m_PixelShader;
};
This class looks somewhat similar to the SkyNode class
it has the two C++ shader
helper classes you
'
ve come to know and love, but there is no vertex or index buffer
'
defined. That
s because the CDXUTSDKMesh class already has them. Note also that the
constructor doesn ' t have a specific texture to send in to the pixel shader.
The VOnRestore() method is very simple
all it does is call the VOnRestore()
methods of the SceneNode parent class and the two shaders before making a call
to
the resource cache to reload the SDKMESH file.
HRESULT D3DShaderMeshNode11::VOnRestore(Scene *pScene)
{
Search WWH ::




Custom Search