/*---------------------------------------------------------------------------* Project: NintendoWare File: GrRenderer.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: $ *---------------------------------------------------------------------------*/ #include #include #include #include #include //! @brief 直方体の頂点ストリーム・インデックスストリームのデータを保持するクラスです。 class PrimitiveBox { private: NW_DISALLOW_COPY_AND_ASSIGN(PrimitiveBox); public: static const u32 VERTEX_NUM = 36; PrimitiveBox() {} virtual ~PrimitiveBox() {} void Initialize(const nn::math::VEC3& halfEdges); void Finalize() {} f32 m_StreamPosition[VERTEX_NUM * 3]; f32 m_StreamNormal [VERTEX_NUM * 3]; f32 m_StreamColor [VERTEX_NUM * 4]; u16 m_StreamIndex [VERTEX_NUM * 1]; }; //! @brief 直方体を描画するクラスです。 class GrPrimitiveRenderer { private: NW_DISALLOW_COPY_AND_ASSIGN(GrPrimitiveRenderer); public: GrPrimitiveRenderer() : m_DeviceAllocator(NULL), m_ShaderBinary(NULL), m_PrimitiveBox(NULL) {} virtual ~GrPrimitiveRenderer() {} public: virtual void Initialize( nw::demo::DemoAllocator* deviceAllocator, const wchar_t* shaderFilePath); virtual void Finalize(); void InitializeShader(const wchar_t* shaderFilePath); // プリミティブの初期化 void InitializePrimitive(); void InitializeEnvironments(); // 無効化のコマンドを生成します bit32* MakeDisableCommand(bit32* command) { return nn::gr::CTR::MakeDisableAllCommand(command); } bit32* MakeSceneBeginCommand(bit32* command); bit32* MakeDrawBoxCommand(bit32* command, const nn::math::MTX34& worldMatrix); bit32* MakeSceneEndCommand(bit32* command) { return MakeDisableCommand(command); } private: nw::demo::DemoAllocator* m_DeviceAllocator; u8* m_ShaderBinary; nn::gr::Shader m_Shader; nn::math::MTX34 m_Mtx; nn::math::MTX44 m_ProjectionMtx; nn::math::MTX34 m_ViewMtx; nn::gr::BindSymbolVSFloat m_BindSymbolWorldMtx; nn::gr::BindSymbolVSFloat m_BindSymbolProjMtx; nn::gr::BindSymbolVSFloat m_BindSymbolViewMtx; nn::gr::Viewport m_Viewport; nn::gr::Scissor m_Scissor; PrimitiveBox* m_PrimitiveBox; nn::gr::Vertex m_VertexBox; nn::gr::Vertex::IndexStream m_IndexStreamBox; };