bool DistortionRenderer::Initialize(const ovrRenderAPIConfig* apiConfig)
{
	///QUESTION - what is returned bool for???  Are we happy with this true, if not config.
    const ovrD3D9Config * config = (const ovrD3D9Config*)apiConfig;
    if (!config)                return true; 
    if (!config->D3D9.pDevice)  return false;

    if (System::DirectDisplayEnabled())
    {
        Ptr<IUnknown> ovrDevice;
        if (config->D3D9.pDevice->QueryInterface(IID_OVRDirect3DDevice9EX, (void**)&ovrDevice.GetRawRef()) == E_NOINTERFACE)
        {
            OVR_DEBUG_LOG_TEXT(("ovr_Initialize() or ovr_InitializeRenderingShim() wasn't called before the D3D9 device was created."));
        }
    }

	//Glean all the required variables from the input structures
	Device         = config->D3D9.pDevice;
    SwapChain      = config->D3D9.pSwapChain;
	ScreenSize     = config->D3D9.Header.BackBufferSize;

	GfxState = *new GraphicsState(Device, RState.DistortionCaps);

	CreateVertexDeclaration();
	CreateDistortionShaders();
	CreateDistortionModels();

    return true;
}
Beispiel #2
0
//=============================================================================
// constructor
//=============================================================================
Application::Application(TSystem in_system)
	:system_(in_system)
	,is_stop_(false)
{
	//auto device = graphic::
	auto graphic_device = system_->GetGraphicDevice();

	vertex_buffer_ = graphic_device->CreateVertexBuffer(sizeof(float3) * 4);

	graphic::GraphicDevice::TVertexElements vertex_elements =
	{
		{0,0,graphic::GraphicDevice::TVertexElement::TYPE::FLOAT3,graphic::GraphicDevice::TVertexElement::USAGE::POSITION,0},
	};

	float3 position[] = 
	{
		float3(-50.0f,-50.0f,0.0f),
		float3( 50.0f,-50.0f,0.0f),
		float3(-50.0f, 50.0f,0.0f),
		float3( 50.0f, 50.0f,0.0f),
	};

	vertex_buffer_->Stream(position,0,sizeof(position));

	vertex_declaration_ = graphic_device->CreateVertexDeclaration(vertex_elements);

	//vertex_shader_ = graphic_device->LoadVertexShader("resources/shader/basic.hlsl");
	//pixel_shader_ = graphic_device->LoadPixelShader("resources/shader/basic.hlsl");
}
Beispiel #3
0
void OvRenderer::RenderUnitRect( OvVertexShaderSPtr v_shader , OvPixelShaderSPtr p_shader )
{
	struct SScreenRect
	{
		OvPoint3 pos; OvPoint2 tex;
	};
	static D3DVERTEXELEMENT9 rect_elem[] =
	{
		{ 0, 0
		, D3DDECLTYPE_FLOAT3
		, D3DDECLMETHOD_DEFAULT
		, D3DDECLUSAGE_POSITION, 0 },

		{ 0, 12
		, D3DDECLTYPE_FLOAT2
		, D3DDECLMETHOD_DEFAULT
		, D3DDECLUSAGE_TEXCOORD, 0 },
		D3DDECL_END()
	};
	static SScreenRect rect[] = 
	{ {OvPoint3(-1,-1,0),OvPoint2(0,1)}
	, {OvPoint3(-1,+1,0),OvPoint2(0,0)}
	, {OvPoint3(+1,+1,0),OvPoint2(1,0)}
	, {OvPoint3(+1,-1,0),OvPoint2(1,1)}};

	static LPDIRECT3DVERTEXBUFFER9 rectVertBuffer = CreateVertexStream( (void*)&rect[0], sizeof( SScreenRect ), 4 );
	static LPDIRECT3DVERTEXDECLARATION9 rectDecl = CreateVertexDeclaration( rect_elem );

	if ( v_shader ) SetVertexShader( v_shader );
	if ( p_shader ) SetPixelShader( p_shader );
	SetVertexStream( 0, SVertexStreamInfo( rectVertBuffer, sizeof( SScreenRect ), 0) );
	SetVertexDeclaration( rectDecl );
	DrawPrimitive( D3DPT_TRIANGLEFAN, 2);
}
Beispiel #4
0
void CDynamicLineDrawer::Initialize()
{
	mRenderOp.operationType = Ogre::RenderOperation::OT_LINE_LIST;
	mRenderOp.useIndexes = false;
	mRenderOp.vertexData = new Ogre::VertexData;

	// Reset buffer capacities
	VertexBufferCapacity = 0;

	// Create vertex declaration
	CreateVertexDeclaration();
}
Beispiel #5
0
Outlines::Outlines(ID3DXMesh* mesh, ID3DXBuffer* adj)
{
	vb = 0;
	ib = 0;
	vertexdecl = 0;
	VertexNumber = 0;
	FaceNumber = 0;

	GenerateOutlineVertices(mesh, adj);
	GenerateOutlineIndices(mesh);
	CreateVertexDeclaration();
}
Beispiel #6
0
//------------------------------------------------------------------------------
// 
//------------------------------------------------------------------------------
bool Sprite3D::init() {
  auto renderer = App::instance().getRenderer();
  auto pDevice = renderer->getDevice();

  // 頂点作成
  if(FAILED(pDevice->CreateVertexBuffer(
    sizeof(VERTEX_3D) * 4,
    D3DUSAGE_WRITEONLY,
    NULL,
    D3DPOOL_MANAGED,
    &_vtxBuff,
    NULL
    ))) {
    return false;
  }

  //頂点バッファ
  VERTEX_3D *pVtx = nullptr;
  //位置更新
  _vtxBuff->Lock(0,0,(void **)&pVtx,0);
  pVtx[0].vtx = D3DXVECTOR3(-0.5f,0.5f,0.f);
  pVtx[1].vtx = D3DXVECTOR3(0.5f,0.5f,0.f);
  pVtx[2].vtx = D3DXVECTOR3(-0.5f,-0.5f,0.f);
  pVtx[3].vtx = D3DXVECTOR3(0.5f,-0.5f,0.f);
  pVtx[0].nor = D3DXVECTOR3(0,0,-1);
  pVtx[1].nor = D3DXVECTOR3(0,0,-1);
  pVtx[2].nor = D3DXVECTOR3(0,0,-1);
  pVtx[3].nor = D3DXVECTOR3(0,0,-1);
  pVtx[0].tex = D3DXVECTOR2(0,0);
  pVtx[1].tex = D3DXVECTOR2(1,0);
  pVtx[2].tex = D3DXVECTOR2(0,1);
  pVtx[3].tex = D3DXVECTOR2(1,1);
  _vtxBuff->Unlock();

  // 頂点
  pDevice->CreateVertexDeclaration(vElement,&_p3DDec);

  // シェーダ
  _vtxShaderID = renderer->getShader()->getVtxShader("vs_model.cso");

  // 色
  _color = D3DXCOLOR(1,1,1,1);

  // 色々初期化
  _numU = 1;
  _numV = 1;
  _animID = 0;
  _texPos = {0,0};
  _texScl = {1.f,1.f};

  return true;
}
Beispiel #7
0
void TerrainRenderable::MakeVertexDeclaration()
{
	auto device = Globals::GetDevice()->GetDeviceD3D9();
	D3DVERTEXELEMENT9 vbDecl[] =
	{
		{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
		{ 0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
		{ 0, 20, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },

		{ 0xFF, 0, D3DDECLTYPE_UNUSED, 0, 0, 0 }
	};
	HRESULT res = device->CreateVertexDeclaration(vbDecl, &m_pVertexDecl);
}
Beispiel #8
0
void TerrainBorderRenderable::MakeVertexDeclaration()
{
	auto device = Globals::GetDevice()->GetDeviceD3D9();
	D3DVERTEXELEMENT9 vbDecl[] =
	{
		{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
		{ 0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },

		{ 0xFF, 0, D3DDECLTYPE_UNUSED, 0, 0, 0 }
	};
	IDirect3DVertexDeclaration9* pVd = 0;
	HRESULT res = device->CreateVertexDeclaration(vbDecl, &pVd);
	m_pVertexDecl.reset(pVd, [&](IDirect3DVertexDeclaration9* p){p->Release(); });

}
Beispiel #9
0
SilhouetteEdges::SilhouetteEdges(IDirect3DDevice9* device,
								 ID3DXMesh* mesh, 
								 ID3DXBuffer* adjBuffer)
{
	m_pDevice   = device;
	m_pVBuf     = NULL;
	m_pIBuf     = NULL;
	m_pDecl     = NULL;
	m_uNumVerts = 0;
	m_uNumFaces = 0;

	GenEdgeVertices(mesh, adjBuffer);
	GenEdgeIndices(mesh);
	CreateVertexDeclaration();
}
Beispiel #10
0
void VertexBufferManager::InitDefaultDeclarations()
{
	/*struct Vertex
	{
		glm::vec3 Position;
		glm::vec3 Normal;
		glm::vec2 TexCoord;
	};*/
	VertexPointer Pointer[3] =	{
		VertexPointer( 0, 3, 8 * sizeof( float ), V_POSITION,	(void*) NULL ),							// wskaŸnik na pozycje
		VertexPointer( 1, 3, 8 * sizeof( float ), V_NORMAL,		(void*) (sizeof( float ) *3 ) ),		// wskaŸnik na normalna
		VertexPointer( 2, 2, 8 * sizeof( float ), V_TEXCOORD,	(void*) (sizeof( float ) *6 ) )			// wskaxnik na tex coordy
	};
	CreateVertexDeclaration( "Default", Pointer, 3 );
	
}
bool DistortionRenderer::Initialize(const ovrRenderAPIConfig* apiConfig,
                                    unsigned arg_distortionCaps)
{
	///QUESTION - what is returned bool for???  Are we happy with this true, if not config.
    const ovrD3D9Config * config = (const ovrD3D9Config*)apiConfig;
    if (!config)                return true; 
    if (!config->D3D9.pDevice)  return false;

	//Glean all the required variables from the input structures
	device         = config->D3D9.pDevice;
    swapChain      = config->D3D9.pSwapChain;
	screenSize     = config->D3D9.Header.RTSize;
	distortionCaps = arg_distortionCaps;

	GfxState = *new GraphicsState(device);

	CreateVertexDeclaration();
	CreateDistortionShaders();
	Create_Distortion_Models();

    return true;
}
Beispiel #12
0
int main(){
	auto pLogger = CB::Log::CLogger::GetInstance();
	pLogger->AddStream(CB::IO::File::Open(L"main.log", CB::IO::File::AccessType::WriteOnly, CB::IO::File::OpenAction::AlwaysCreate).Cast<CB::IO::IStream>());
	pLogger->AddStream(CB::IO::Console::Create().Cast<CB::IO::IStream>(), CB::Log::CTextFormatter::Create(CB::String::Encoding::ANSI).Cast<CB::Log::IEntryFormatter>());
	pLogger->SetDebugMode(true);

	try{
		auto pWinDriver = CB::Window::LoadDriver(L"MSWindowDriver");
		auto pGraphicDriver = CB::Graphic::LoadDriver(L"OGLGraphicDriver");
		{
			auto pWinManager = pWinDriver->CreateManager();
			auto pGraphicManager = pGraphicDriver->CreateManager(pWinManager);
			
			CB::Math::CSize outSize(640, 480);
			auto pWindow = pWinManager->CreateWindow(L"GraphicTest", CB::Window::Style::Single, outSize);

			auto pGraphicAdapter = pGraphicManager->GetDefaultAdapter();

			CB::Graphic::CDisplayMode dispMode(pWindow->GetSize(), 0, CB::Graphic::BufferFormat::B8G8R8X8);
			CB::Graphic::CDeviceDesc devDesc(pWindow, dispMode, CB::Graphic::BufferFormat::D24S8, false);

			CB::Collection::CList<CB::Graphic::FeatureLevel> featureLevels;
			featureLevels.Add(CB::Graphic::FeatureLevel::Level_1);

			auto pGraphicDevice = pGraphicAdapter->CreateDevice(pWindow, devDesc, featureLevels);

			pWindow->OnClose += CB::Signals::CFunc<const bool, CB::CRefPtr<CB::Window::IWindow>>(CloseEvent);

			pWindow->SetVisible(true);

			CB::Graphic::CDepthStencilStateDesc depthDesc;
			depthDesc.bDepthTestEnabled = true;
			depthDesc.uDepthFunction = CB::Graphic::CompareFunc::LessEqual;
			auto pDepthState = pGraphicDevice->CreateState(depthDesc);
			pGraphicDevice->SetState(pDepthState.Cast<CB::Graphic::IDeviceState>());

			CB::Graphic::CRasterizerStateDesc rastDesc;
			rastDesc.uCullMode = CB::Graphic::CullMode::None;
			auto pRastState = pGraphicDevice->CreateState(rastDesc);
			pGraphicDevice->SetState(pRastState.Cast<CB::Graphic::IDeviceState>());

			CB::Graphic::CBlendStateDesc blendDesc;
			blendDesc.ColorBlend.uDestOperand = CB::Graphic::BlendOption::OneMinusSourceAlpha;
			blendDesc.ColorBlend.uSourceOperand = CB::Graphic::BlendOption::SourceAlpha;
			blendDesc.ColorBlend.uOperation = CB::Graphic::BlendOperation::Add;
			blendDesc.AlphaBlend.uDestOperand = CB::Graphic::BlendOption::OneMinusSourceAlpha;
			blendDesc.AlphaBlend.uSourceOperand = CB::Graphic::BlendOption::SourceAlpha;
			blendDesc.AlphaBlend.uOperation = CB::Graphic::BlendOperation::Add;
			blendDesc.bEnabled[0] = true;
			auto pBlendState = pGraphicDevice->CreateState(blendDesc);
			pGraphicDevice->SetState(pBlendState.Cast<CB::Graphic::IDeviceState>());

			auto pFontManager = CB::Font::CManager::Create();

			auto pFontStream = CB::IO::File::Open(L"Assets/font.ttf").Cast<CB::IO::IStream>();
			auto pFont = pFontManager->Load(pFontStream);
			
			pFont->SelectFace(0);
			pFont->SetSize(24);

			CB::Collection::CList<CB::Tools::CFontCharDesc> charDescs;
			CB::Tools::CFontTextureGenerator fontGen(pGraphicDevice);

			fontGen.MaxTextureSize.Set(512, 512);
			auto pTexture = fontGen.Generate(pFont, charDescs);

			CB::Tools::CTextMeshGenerator textGen(charDescs);
			CB::Tools::CMeshRawIVT textMesh;

			textGen.Generate(L"Marek	M³ynarski!", textMesh);

			CB::Collection::CList<CB::Graphic::CVertexElement> vEls;
			vEls.Add(CB::Graphic::CVertexElement(0, L"vinput.vPosition", CB::Graphic::VertexType::Float, 3, 0));
			vEls.Add(CB::Graphic::CVertexElement(1, L"vinput.vTexCoord", CB::Graphic::VertexType::Float, 2, 0));

			GraphicTest::CShaderLoader shaders(pGraphicDevice, L"Shaders/TextureShader.cg");

			auto pTextDecl = pGraphicDevice->CreateVertexDeclaration(shaders.pVertexShader, vEls);

			auto pTextVertexBuffer = pGraphicDevice->CreateBuffer(CB::Graphic::BufferType::Vertex, CB::Graphic::BufferUsage::Dynamic, CB::Graphic::BufferAccess::Write, textMesh.Vertices);
			auto pTextTCoordBuffer = pGraphicDevice->CreateBuffer(CB::Graphic::BufferType::Vertex, CB::Graphic::BufferUsage::Dynamic, CB::Graphic::BufferAccess::Write, textMesh.TexCoords);
			auto pTextIndexBuffer = pGraphicDevice->CreateBuffer(CB::Graphic::BufferType::Index, CB::Graphic::BufferUsage::Dynamic, CB::Graphic::BufferAccess::Write, textMesh.Indices);

			float32 fAspect = (float32)outSize.Width / (float32)outSize.Height;
			CB::Math::CMatrix mProj = CB::Math::CMatrix::GetPerspective(fAspect, 60.0f, 1.0f, 100.0f);
			CB::Math::CMatrix mView = CB::Math::CMatrix::GetTranslation(-4.0f, 0.0f, -3.4f);
			CB::Math::CMatrix mModel = CB::Math::CMatrix::GetIdentity();

			shaders.pFragmentShader->SetSampler(L"texDiffuse", pTexture.Cast<CB::Graphic::IBaseTexture>());
			pTexture->SetFilters(CB::Graphic::TextureFilter::Linear, CB::Graphic::TextureFilter::Linear, CB::Graphic::TextureFilter::Linear);
			pTexture->SetAnisotropy(8);
			//g_pTexture = texture.pTexture;			

			while(g_bRun){
				pGraphicDevice->Clear(1.0f, 1);
				pGraphicDevice->Clear(CB::Math::CColor(1.0f, 0.5f, 0.0f, 1.0f));

				pGraphicDevice->BeginRender();

				pGraphicDevice->SetShader(shaders.pVertexShader);
				pGraphicDevice->SetShader(shaders.pFragmentShader);

				static float32 fV = 0.0f;
				fV += 20 * g_Timer.GetTimeDelta();
				mModel = CB::Math::CMatrix::GetRotation(CB::Math::AxisOrientation::AxisX, fV);

				shaders.pVertexShader->SetUniform(L"vinput.mProj", mProj);
				shaders.pVertexShader->SetUniform(L"vinput.mView", mView);
				shaders.pVertexShader->SetUniform(L"vinput.mModel", mModel);

				pGraphicDevice->SetVertexDeclaration(pTextDecl);
				pGraphicDevice->SetVertexBuffer(0, pTextVertexBuffer);
				pGraphicDevice->SetVertexBuffer(1, pTextTCoordBuffer);
				pGraphicDevice->SetIndexBuffer(pTextIndexBuffer);

				pGraphicDevice->RenderIndexed(textMesh.uNumberOfPolygons);

				pGraphicDevice->EndRender();

				g_Timer.Update();
				pWinManager->ProcessEvents();

				float fFPS = 1.0f / (g_Timer.GetTimeDelta() == 0.0f ? 1.0f : g_Timer.GetTimeDelta());
				uint32 uFPS = (uint32)fFPS;

				textMesh.Clear();
				textGen.Generate(L"FPS: " + CB::String::ToString(uFPS), textMesh);

				pTextVertexBuffer->LoadData(textMesh.Vertices);
				pTextTCoordBuffer->LoadData(textMesh.TexCoords);
				pTextIndexBuffer->LoadData(textMesh.Indices);

				pGraphicDevice->Swap();
			}

			g_pTexture.Release();
		}
	}
	catch(CB::Exception::CException& Exception){
		CB::Log::Write(Exception, CB::Log::LogLevel::Fatal);
		CB::Message::Show(Exception, CB::Message::Icon::Error);
	}
	return 0;
}
Beispiel #13
0
	// *** ** **** ** **** ***** ** **** ******** ****** ****** *** *******
	// bad az Init ba seda zadan in tabe maghadir avalie engine set mishan.
	// *** ** **** ** **** ***** ** **** ******** ****** ****** *** *******
	bool RendererGL::AfterInit()
	{
		// Mohasebeye dorbine 2 bodi.
// 		m_m2D._11 = (float)2/(m_Params.Width);
// 		m_m2D._22 = (float)2/(-m_Params.Height);
// 		m_m2D._12 = m_m2D._13 = m_m2D._14 = m_m2D._21 = m_m2D._23 = m_m2D._24 =
// 		m_m2D._31 = m_m2D._32 = m_m2D._34 = m_m2D._43 = 0.0f;
// 		m_m2D._41 = m_m2D._33 = -1.0f;
// 		m_m2D._44 = m_m2D._42 = 1.0f;
		// Calculate the 2D camera matrix.
		m_m2D.SetOrthoOffscreenLH(0.0f, m_Params.Width, m_Params.Height, 0.0f, 0.0f, 1.0f);

		glViewport(0 ,0 ,m_Params.Width ,m_Params.Height);		// Make our viewport the whole window

		// Enables Depth Testing
		glEnable(GL_DEPTH_TEST);
		// Enable texturing.
		glEnable(GL_TEXTURE_2D);
		// Enable backface culling.
		glEnable(GL_CULL_FACE);
		glCullFace(GL_FRONT);

		// GLEW INIT
 		GLenum err = glewInit();
 
 		if ( err != GLEW_OK )
 		{
 			io::Logger::Log((const char*)glewGetErrorString(err), kge::io::ELM_Error);
 		}
 		else
 		{
 			io::Logger::Log(kge::io::ELM_Information, "OPENGL version: %s", glGetString(GL_VERSION));
 		}

		// Creating a timer.
		m_pTimer = new core::Timer();
		m_pTimer->Interval = 1000;
		m_iFPS = 0;
		m_iFPSTemp = 0;

		// Precalculate the graphics card capacities.
		InitGCC();

		// Create m_pV2
		CustomVertexElement decl[] =
		{
			{0,  0, EVET_Float2, EVEM_Default, EVEU_Position, 0},
			CusVertexEND()
		};		
		m_ppVertexDecs[EVT_V2] = CreateVertexDeclaration(decl, "V2");

		// Create m_pV3
		CustomVertexElement decl2[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3] = CreateVertexDeclaration(decl2, "V3");

		// Create m_pV3C
		CustomVertexElement decl3[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Color, EVEM_Default, EVEU_Color, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3C] = CreateVertexDeclaration(decl3, "V3C");

		// Create m_pV3T
		CustomVertexElement decl4[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3T] = CreateVertexDeclaration(decl4, "V3T");

		// Create m_pV3CT
		CustomVertexElement decl8[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Float4, EVEM_Default, EVEU_Color, 0},
			{0,  28, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3CT] = CreateVertexDeclaration(decl8, "V3CT");

		// Create m_pV3TN
		CustomVertexElement decl5[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Float3, EVEM_Default, EVEU_Normal, 0},
			{0,  24, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3TN] = CreateVertexDeclaration(decl5, "V3TN");

		// Create m_pV3TNC
		CustomVertexElement decl6[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Float3, EVEM_Default, EVEU_Normal, 0},
			{0,  24, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			{0,  32, EVET_Float1, EVEM_Default, EVEU_Color, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3TNC] = CreateVertexDeclaration(decl6, "V3TNC");

		// Create m_pV3TTN
		CustomVertexElement decl7[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_Float3, EVEM_Default, EVEU_Normal, 0},
			{0,  24, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			{0,  32, EVET_Float2, EVEM_Default, EVEU_TexCoord, 1},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_V3TTN] = CreateVertexDeclaration(decl7, "V3TTN");

		// Create m_pP0NT1BT2
		CustomVertexElement decl9[] =
		{
			{0,  0,  EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{1,  0,  EVET_Float3, EVEM_Default, EVEU_Normal,   0},
			{1,  12, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			{2,  0,  EVET_Float3, EVEM_Default, EVEU_Tangent,  0},
			{2,  12, EVET_Float3, EVEM_Default, EVEU_Binormal, 0},
			{3,  0,  EVET_Float4, EVEM_Default, EVEU_TexCoord, 1},
			{3,  16, EVET_Float4, EVEM_Default, EVEU_TexCoord, 2},
			{3,  32, EVET_Float4, EVEM_Default, EVEU_TexCoord, 3},
			{3,  48, EVET_Float4, EVEM_Default, EVEU_TexCoord, 4},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_P0NT1BT2I3] = CreateVertexDeclaration(decl9, "P0NT1BT2");

		// Create m_pP0NTC1BT2
		CustomVertexElement decl11[] =
		{
			{0,  0,  EVET_Float3,   EVEM_Default, EVEU_Position, 0},
			{1,  0,  EVET_Float3,   EVEM_Default, EVEU_Normal, 0},
			{1,  12, EVET_Float2,   EVEM_Default, EVEU_TexCoord, 0},
			{1,  20, EVET_Color, 	EVEM_Default, EVEU_Color, 0},
			{2,  0,  EVET_Float3,   EVEM_Default, EVEU_Tangent, 0},
			{2,  12, EVET_Float3,   EVEM_Default, EVEU_Binormal, 0},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_P0NTC1BT2] = CreateVertexDeclaration(decl11, "P0NTC1BT2");

		// Create m_pPJ0NT1BT2
		CustomVertexElement decl10[] =
		{
			{0,  0, EVET_Float3, EVEM_Default, EVEU_Position, 0},
			{0,  12, EVET_UByte4, EVEM_Default, EVEU_Color, 0},
			{1,  0, EVET_Float3, EVEM_Default, EVEU_Normal, 0},
			{1,  12, EVET_Float2, EVEM_Default, EVEU_TexCoord, 0},
			{2,  0, EVET_Float3, EVEM_Default, EVEU_Tangent, 0},
			{2,  12, EVET_Float3, EVEM_Default, EVEU_Binormal, 0},
			{3,  0,  EVET_Float4, EVEM_Default, EVEU_TexCoord, 1},
			{3,  16, EVET_Float4, EVEM_Default, EVEU_TexCoord, 2},
			{3,  32, EVET_Float4, EVEM_Default, EVEU_TexCoord, 3},
			{3,  48, EVET_Float4, EVEM_Default, EVEU_TexCoord, 4},
			CusVertexEND()
		};		

		m_ppVertexDecs[EVT_PJ0NT1BT2I3] = CreateVertexDeclaration(decl10, "PJ0NT1BT2");

		return true;

	} // AfterInit()