void Graphics::InitializeVertexDeclarations(Graphics* gfx) { IDirect3DDevice9* device = gfx->GetDevice(); // nitVERTEXCOLOR D3DVERTEXELEMENT9 elements_d3dvertexcolor[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; device->CreateVertexDeclaration(elements_d3dvertexcolor, &nitVERTEXCOLOR::decl); // nitVERTEXSCREEN D3DVERTEXELEMENT9 elements_d3dvertexscreen[] = { {0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITIONT, 0}, {0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, {0, 24, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; device->CreateVertexDeclaration(elements_d3dvertexscreen, &nitVERTEXSCREEN::decl); // nitVERTEX D3DVERTEXELEMENT9 elements_d3dvertex[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() }; device->CreateVertexDeclaration(elements_d3dvertex, &nitVERTEX::decl); }
void VertexDeclaration::Create(Graphics* graphics, const PODVector<VertexDeclarationElement>& elements) { SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.Size() + 1]); D3DVERTEXELEMENT9* dest = elementArray; for (Vector<VertexDeclarationElement>::ConstIterator i = elements.Begin(); i != elements.End(); ++i) { dest->Stream = i->stream_; dest->Offset = i->offset_; dest->Type = d3dElementType[i->element_]; dest->Method = D3DDECLMETHOD_DEFAULT; dest->Usage = d3dElementUsage[i->element_]; dest->UsageIndex = d3dElementUsageIndex[i->element_]; dest++; } dest->Stream = 0xff; dest->Offset = 0; dest->Type = D3DDECLTYPE_UNUSED; dest->Method = 0; dest->Usage = 0; dest->UsageIndex = 0; IDirect3DDevice9* device = graphics->GetImpl()->GetDevice(); if (!device) return; device->CreateVertexDeclaration(elementArray, &declaration_); }
void VertexDeclaration::Create(Graphics* graphics, const PODVector<VertexDeclarationElement>& elements) { SharedArrayPtr<D3DVERTEXELEMENT9> elementArray(new D3DVERTEXELEMENT9[elements.Size() + 1]); D3DVERTEXELEMENT9* dest = elementArray; for (Vector<VertexDeclarationElement>::ConstIterator i = elements.Begin(); i != elements.End(); ++i) { dest->Stream = (WORD)i->streamIndex_; dest->Offset = (WORD)i->offset_; dest->Type = d3dElementType[i->type_]; dest->Method = D3DDECLMETHOD_DEFAULT; dest->Usage = d3dElementUsage[i->semantic_]; dest->UsageIndex = i->index_; dest++; } dest->Stream = 0xff; dest->Offset = 0; dest->Type = D3DDECLTYPE_UNUSED; dest->Method = 0; dest->Usage = 0; dest->UsageIndex = 0; IDirect3DDevice9* device = graphics->GetImpl()->GetDevice(); HRESULT hr = device->CreateVertexDeclaration(elementArray, &declaration_); if (FAILED(hr)) { URHO3D_SAFE_RELEASE(declaration_); URHO3D_LOGD3DERROR("Failed to create vertex declaration", hr); } }
bool GPUContextDX9::initialize() { _window = DX9Window::create(); if( _window == NULL ) { DX9WARN << "Could not create offscreen window."; return false; } HWND windowHandle = _window->getWindowHandle(); _direct3D = Direct3DCreate9( D3D_SDK_VERSION ); if( _direct3D == NULL ) { DX9WARN << "Could not create Direct3D interface."; return false; } D3DPRESENT_PARAMETERS deviceDesc; ZeroMemory( &deviceDesc, sizeof(deviceDesc) ); deviceDesc.Windowed = TRUE; deviceDesc.SwapEffect = D3DSWAPEFFECT_DISCARD; deviceDesc.BackBufferFormat = D3DFMT_UNKNOWN; deviceDesc.EnableAutoDepthStencil = FALSE; deviceDesc.AutoDepthStencilFormat = D3DFMT_D24S8; HRESULT result = _direct3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, windowHandle, D3DCREATE_HARDWARE_VERTEXPROCESSING, &deviceDesc, &_device ); if( FAILED(result) ) { DX9WARN << "Could not create Direct3D device."; return false; } // create vertex buffer static const int kMaxVertexCount = 64; result = _device->CreateVertexBuffer( kMaxVertexCount*sizeof(DX9Vertex), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &_vertexBuffer, NULL ); DX9AssertResult( result, "CreateVertexBuffer failed" ); result = _device->CreateVertexDeclaration( kDX9VertexElements, &_vertexDecl ); DX9AssertResult( result, "CreateVertexDeclaration failed" ); // TIM: set up initial state result = _device->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); GPUAssert( !FAILED(result), "SetRenderState failed" ); _passthroughVertexShader = createVertexShader( kPassthroughVertexShaderSource ); _passthroughPixelShader = createPixelShader( kPassthroughPixelShaderSource ); for( size_t i = 0; i < kMaximumOutputCount; i++ ) _boundOutputs[i] = NULL; for( size_t t = 0; t < kMaximumSamplerCount; t++ ) _boundTextures[t] = NULL; return true; }
gl::Error Blit9::initialize() { if (mGeometryLoaded) { return gl::Error(GL_NO_ERROR); } static const float quad[] = { -1, -1, -1, 1, 1, -1, 1, 1 }; IDirect3DDevice9 *device = mRenderer->getDevice(); HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL); if (FAILED(result)) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal blit vertex shader, result: 0x%X.", result); } void *lockPtr = NULL; result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0); if (FAILED(result) || lockPtr == NULL) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); SafeRelease(mQuadVertexBuffer); return gl::Error(GL_OUT_OF_MEMORY, "Failed to lock internal blit vertex shader, result: 0x%X.", result); } memcpy(lockPtr, quad, sizeof(quad)); mQuadVertexBuffer->Unlock(); static const D3DVERTEXELEMENT9 elements[] = { { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, D3DDECL_END() }; result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration); if (FAILED(result)) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); SafeRelease(mQuadVertexBuffer); return gl::Error(GL_OUT_OF_MEMORY, "Failed to lock internal blit vertex declaration, result: 0x%X.", result); } mGeometryLoaded = true; return gl::Error(GL_NO_ERROR); }
void Blit::initGeometry() { static const float quad[] = { -1, -1, -1, 1, 1, -1, 1, 1 }; IDirect3DDevice9 *device = getDevice(); HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL); if (FAILED(result)) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); return error(GL_OUT_OF_MEMORY); } void *lockPtr = NULL; result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0); if (FAILED(result) || lockPtr == NULL) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); return error(GL_OUT_OF_MEMORY); } memcpy(lockPtr, quad, sizeof(quad)); mQuadVertexBuffer->Unlock(); static const D3DVERTEXELEMENT9 elements[] = { { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, D3DDECL_END() }; result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration); if (FAILED(result)) { ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY); return error(GL_OUT_OF_MEMORY); } }
//---------------------------------------------------------------------------- PdrVertexFormat::PdrVertexFormat (Renderer* renderer, const VertexFormat* vformat) { IDirect3DDevice9* device = renderer->mData->mDevice; const int numAttributes = vformat->GetNumAttributes(); for (int i = 0; i < numAttributes; ++i) { // 获得与平台无关的顶点属性 unsigned int streamIndex; unsigned int offset; VertexFormat::AttributeType type; VertexFormat::AttributeUsage usage; unsigned int usageIndex; vformat->GetAttribute(i, streamIndex, offset, type, usage, usageIndex); // 设置Dx9属性 D3DVERTEXELEMENT9 &element = mElements[i]; element.Stream = (WORD)streamIndex; element.Offset = (WORD)offset; element.Type = gDX9AttributeType[type]; element.Method = D3DDECLMETHOD_DEFAULT; element.Usage = gDX9AttributeUsage[usage]; element.UsageIndex = (BYTE)usageIndex; } // 最后一个DX9 element必须是D3DDECL_END(). D3DVERTEXELEMENT9 &element = mElements[numAttributes]; element.Stream = 0xFF; element.Offset = 0; element.Type = D3DDECLTYPE_UNUSED; element.Method = 0; element.Usage = 0; element.UsageIndex = 0; HRESULT hr = device->CreateVertexDeclaration(mElements, &mDeclaration); PX2_UNUSED(hr); assertion(hr == D3D_OK, "Failed to create vertex declaration: %s\n", DXGetErrorString(hr)); }
void DX9VertexDecl::endBuild(HDResourceMgr *pMgr) { ASSERT(pMgr); ASSERT(m_elementArray.size() > 0); // -- D3DVERTEXELEMENT9 em = D3DDECL_END(); m_elementArray.push_back(em); // -- DX9ResourceMgr* pDX9Mgr = (DX9ResourceMgr*)pMgr; IDirect3DDevice9* pDev = pDX9Mgr->getDX9Device(); HRESULT hr; hr = pDev->CreateVertexDeclaration(&m_elementArray[0], &m_pDecl); if(FAILED(hr)) { throw HDAPIException("vertex declaration created failed."); } }
void NX::Sphere::CreateTriangles() { int nV = (m_iStacks - 1) * (m_iSlices + 1) + 2, r, c; int nI = (m_iStacks - 2) * (m_iSlices + 1) * 2 + (m_iSlices + 2) * 2; float rr = kfPiOver2, rc, dr = kfPi / m_iStacks, dc = kf2Pi / m_iSlices; float sr, cr, sc, cc; IDirect3DDevice9 *pDevice = glb_GetD3DDevice(); m_pVertexs = new Vertex[nV]; {//calculate vertex data Vertex *pVertex = m_pVertexs; *pVertex++ = { 0.f, m_fRadius, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f }; for (r = 1; r < m_iStacks; ++r) { rr -= dr; rc = 0.f; cr = std::cosf(rr), sr = std::sinf(rr); for (c = 0; c <= m_iSlices; ++c) { sc = std::sinf(rc); cc = std::cosf(rc); *pVertex++ = { m_fRadius * cr * cc, m_fRadius * sr, m_fRadius * cr * sc, c * 1.f / m_iSlices, r * 1.f / m_iStacks, cr * cc, sr, cr * sc }; rc += dc; } } *pVertex = { 0.f, -m_fRadius, 0.f, 0.f, 1.f, 0.f, -1.f, 0.f }; pDevice->CreateVertexBuffer(sizeof(Vertex) * nV, D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &m_pVertexBuffer, nullptr); void *pBase = nullptr; m_pVertexBuffer->Lock(0, 0, &pBase, D3DLOCK_DISCARD); memcpy(pBase, m_pVertexs, sizeof(Vertex) * nV); m_pVertexBuffer->Unlock(); } {//vertex desc D3DVERTEXELEMENT9 VertexDesc[] = { { 0, CLS_MEM_OFFSET(Vertex, x), D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, CLS_MEM_OFFSET(Vertex, u), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, CLS_MEM_OFFSET(Vertex,nx), D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, D3DDECL_END(), }; pDevice->CreateVertexDeclaration(VertexDesc, &m_pVertexDesc); } {//calculate index data pDevice->CreateIndexBuffer(nI * sizeof(int), D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &m_pIndexBuffer, nullptr); int *pBase = nullptr; m_pIndexBuffer->Lock(0, 0, (void**)&pBase, D3DLOCK_DISCARD); for (int i = 0; i <= m_iSlices + 1; ++i) {//first stack, triangle_fan *pBase++ = i; } int a = 1; for (int i = 1; i < m_iStacks - 1; ++i) {//inner stacks, triangle_list for (int j = 0; j <= m_iSlices; ++j) { *pBase++ = a; *pBase++ = a + m_iSlices + 1; ++a; } } *pBase++ = (m_iStacks - 1) * (m_iSlices + 1) + 1; for (int i = 0; i <= m_iSlices; ++i) { *pBase++ = (m_iStacks - 2) * (m_iSlices + 1) + 1 + i; } m_pIndexBuffer->Unlock(); } }
//----------------------------------------------------------------------- IDirect3DVertexDeclaration9* D3D9VertexDeclaration::getD3DVertexDeclaration(void) { IDirect3DDevice9* pCurDevice = D3D9RenderSystem::getActiveD3D9Device(); DeviceToDeclarationIterator it = mMapDeviceToDeclaration.find(pCurDevice); IDirect3DVertexDeclaration9* lpVertDecl = NULL; // Case we have to create the declaration for this device. if (it == mMapDeviceToDeclaration.end() || it->second == NULL) { D3DVERTEXELEMENT9* d3delems = new D3DVERTEXELEMENT9[mElementList.size() + 1]; VertexElementList::const_iterator i, iend; unsigned int idx; iend = mElementList.end(); for (idx = 0, i = mElementList.begin(); i != iend; ++i, ++idx) { d3delems[idx].Method = D3DDECLMETHOD_DEFAULT; d3delems[idx].Offset = static_cast<WORD>(i->getOffset()); d3delems[idx].Stream = i->getSource(); d3delems[idx].Type = D3D9Mappings::get(i->getType()); d3delems[idx].Usage = D3D9Mappings::get(i->getSemantic()); // NB force index if colours since D3D uses the same usage for // diffuse & specular if (i->getSemantic() == VES_SPECULAR) { d3delems[idx].UsageIndex = 1; } else if (i->getSemantic() == VES_DIFFUSE) { d3delems[idx].UsageIndex = 0; } else { d3delems[idx].UsageIndex = static_cast<BYTE>(i->getIndex()); } } // Add terminator d3delems[idx].Stream = 0xff; d3delems[idx].Offset = 0; d3delems[idx].Type = D3DDECLTYPE_UNUSED; d3delems[idx].Method = 0; d3delems[idx].Usage = 0; d3delems[idx].UsageIndex = 0; HRESULT hr = pCurDevice->CreateVertexDeclaration(d3delems, &lpVertDecl); if (FAILED(hr)) { OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Cannot create D3D9 vertex declaration: " + Root::getSingleton().getErrorDescription(hr), "Direct3D9VertexDeclaration::getD3DVertexDeclaration"); } delete [] d3delems; mMapDeviceToDeclaration[pCurDevice] = lpVertDecl; } // Declaration already exits. else { lpVertDecl = mMapDeviceToDeclaration[pCurDevice]; } return lpVertDecl; }
void CShowPoints9::SetMesh(LPD3DXMESH pNewMesh, LPD3DXSKININFO pNewSkin) { HRESULT hr = S_OK; NumPoints = 0; UnskinnedVB.resize(0); SAFE_RELEASE(SkinnedVB); SAFE_RELEASE(Skin); if(pNewMesh == NULL) return; IDirect3DDevice9* device = DXUTGetD3D9Device(); {//EFFECT V( device->CreateVertexDeclaration( Elements, &Declaration ) ); ID3DXBuffer* pErrors = NULL; V( SASCreateEffectFromResource( device, NULL, MAKEINTRESOURCE(IDR_SHOWLINES9FX), MAKEINTRESOURCE(RT_RCDATA), NULL, NULL, 0, NULL, &Effect, &pErrors)); if(pErrors) DXVGetApp().OutputA( (const char*)pErrors->GetBufferPointer() ); SAFE_RELEASE(pErrors); }//EFFECT D3DVERTEXELEMENT9 declIn[ MAX_FVF_DECL_SIZE ]; V( pNewMesh->GetDeclaration(declIn) ); int iPos= -1; int iNorm= -1; for( int i = 0 ; declIn[i].Stream != 255 && i < MAX_FVF_DECL_SIZE; i++) { if(declIn[i].Usage == D3DDECLUSAGE_POSITION && declIn[i].UsageIndex == 0) iPos = i; if(declIn[i].Usage == D3DDECLUSAGE_NORMAL && declIn[i].UsageIndex == 0) iNorm = i; } if(iPos == -1 || iNorm == -1) return; if( (( declIn[iPos].Type & (D3DDECLTYPE_FLOAT3|D3DDECLTYPE_FLOAT4)) == 0 ) || (( declIn[iNorm].Type & (D3DDECLTYPE_FLOAT3|D3DDECLTYPE_FLOAT4)) == 0 ) ) return; NumPoints = pNewMesh->GetNumVertices(); int MeshStride = pNewMesh->GetNumBytesPerVertex(); if(pNewSkin) { V( pNewSkin->Clone( &Skin ) ); V( Skin->SetDeclaration(Elements) ); } //GET VERTEX DATA BYTE* pSrcVB= NULL; V( pNewMesh->LockVertexBuffer( D3DLOCK_READONLY, (LPVOID*)&pSrcVB ) ); UnskinnedVB.resize(pNewMesh->GetNumVertices()); for( DWORD iVert = 0; iVert < pNewMesh->GetNumVertices(); iVert++) { Vertex& v0 = UnskinnedVB[iVert]; v0.Position = *(D3DXVECTOR3*) (pSrcVB+(MeshStride*iVert)+declIn[iPos].Offset); } V( pNewMesh->UnlockVertexBuffer() ); V( device->CreateVertexBuffer( NumPoints*Stride , D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &SkinnedVB, NULL) ); //Fill in with initial values so unskinned meshes do not have to do this every render. pSrcVB=(BYTE*)(void*)&UnskinnedVB.front(); BYTE* pDstVB=NULL; V( SkinnedVB->Lock(0, 0, (void**)&pDstVB, 0 ) ); { memcpy( pDstVB, pSrcVB, Stride*pNewMesh->GetNumVertices() ); } V( SkinnedVB->Unlock() ); }
void CFullscreenTriangleDrawer::CreateDX9Resources() { HRESULT hr = S_OK; float VertexData[] = { -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 3.0f, 1.0f, 0.0f, 2.0f, 0.0f, -1.0f, -3.0f, 0.0f, 0.0f, 2.0f, }; IDirect3DDevice9* pDevice = static_cast<IDirect3DDevice9*>( gD3DDevice ); // Vertex buffer hr = pDevice->CreateVertexBuffer( sizeof( VertexData ), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &m_pVertexBuffer, NULL ); CRY_ASSERT( SUCCEEDED( hr ) ); float* pVertexBuffer = NULL; hr = m_pVertexBuffer->Lock( 0, 0, ( void** )&pVertexBuffer, 0 ); CRY_ASSERT( SUCCEEDED( hr ) ); memcpy( pVertexBuffer, VertexData, sizeof( VertexData ) ); m_pVertexBuffer->Unlock(); // Vertex declaration D3DVERTEXELEMENT9 VertexElements[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() }; hr = pDevice->CreateVertexDeclaration( VertexElements, &m_pVertexDeclaration ); CRY_ASSERT( SUCCEEDED( hr ) ); // Vertex shader /* // FSTriangle.vs // fxc /O2 /T vs_2_0 /E VSMain float Width : register(c0); float Height : register(c1); struct VertexPT { float4 PositionL : POSITION0; float2 TexCoord : TEXCOORD0; }; VertexPT VSMain(VertexPT vsIn) { vsIn.PositionL += float4(-0.5 / Width, 0.5 / Height, 0, 0); return vsIn; } */ const char CompiledVS[] = { 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x28, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0xab, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x69, 0x64, 0x74, 0x68, 0x00, 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, }; hr = pDevice->CreateVertexShader( ( DWORD* )CompiledVS, &m_pVertexShader9 ); CRY_ASSERT( SUCCEEDED( hr ) ); // Pixel shader /* // FSTriangle.ps // fxc /O2 /T ps_2_0 /E PSMain texture Texture : register(s0); sampler PointSampler = sampler_state { Texture = <Texture>; MinFilter = Point; MagFilter = Point; MipFilter = Point; MaxAnisotropy = 1; AddressU = CLAMP; AddressV = CLAMP; }; struct VertexPT { float4 PositionL : POSITION0; float2 TexCoord : TEXCOORD0; }; float4 PSMain(VertexPT psIn) : COLOR { return tex2D(PointSampler, psIn.TexCoord); } */ const char CompiledPS[] = { 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0xab, 0xab, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, }; hr = pDevice->CreatePixelShader( ( DWORD* )CompiledPS, &m_pPixelShader9 ); CRY_ASSERT( SUCCEEDED( hr ) ); hr = pDevice->CreateStateBlock( D3DSBT_ALL, &m_pStateBlock ); CRY_ASSERT( SUCCEEDED( hr ) ); }