这篇教程C++ D3DXVECTOR2函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中D3DXVECTOR2函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DXVECTOR2函数的具体用法?C++ D3DXVECTOR2怎么用?C++ D3DXVECTOR2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了D3DXVECTOR2函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: D3DXVECTOR2// Author : masato masuda////*****************************************************************************//*****************************************************************************// include//*****************************************************************************#include "sprite_smooth.h"#include "render/sprite.h"#include "system/system.h"#include "system/directx9/texture/texture.h"//*****************************************************************************// constant definition//*****************************************************************************const D3DXVECTOR2 SpriteSmooth::DEFAULT_POSITION = D3DXVECTOR2(0.0f, 0.0f);const D3DXVECTOR2 SpriteSmooth::DEFAULT_SIZE = D3DXVECTOR2(0.0f, 0.0f);const D3DXVECTOR2 CLEAR_VECTOR2 = D3DXVECTOR2(0.0f, 0.0f);const D3DXCOLOR CLEAR_COLOR = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);const f32 HALF_PI = D3DX_PI / 2.0f;//=============================================================================// constructor//=============================================================================SpriteSmooth::SpriteSmooth(void) :sprite_(nullptr) ,dest_frame_(0) ,now_frame_(0) ,is_move_(false)
开发者ID:G-06,项目名称:CaseStudy,代码行数:31,
示例2: CreateFileHRESULT Engine::CTerrainTex::Create_Buffer(const _ushort& wCntX, const _ushort& wCntZ, const _ushort& wItv){ HANDLE hFile; _ulong dwByte; hFile = CreateFile(L"../Resource/Texture/StageScene/Terrain/Height.bmp", GENERIC_READ, 0 , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); BITMAPFILEHEADER fh; BITMAPINFOHEADER ih; ReadFile(hFile, &fh, sizeof(fh), &dwByte, NULL); ReadFile(hFile, &ih, sizeof(ih), &dwByte, NULL); _ulong* pdwPixel = new _ulong[ih.biWidth * ih.biHeight]; ReadFile(hFile, pdwPixel, sizeof(_ulong) * ih.biWidth * ih.biHeight, &dwByte, NULL); CloseHandle(hFile); m_dwVtxSize = sizeof(VTXTEX); m_dwVtxCnt = wCntX * wCntZ ; m_dwVtxFVF = VTXFVF_TEX; m_dwIdxSize = sizeof(INDEX16); m_IdxFmt = D3DFMT_INDEX16; m_dwTriCnt = (wCntX - 1) * (wCntZ - 1) * 2; FAILED_CHECK(CVIBuffer::Create_Buffer()); VTXTEX* pVtxTex = NULL; m_pVB->Lock(0, 0, (void**)&pVtxTex, 0); int iIndex = NULL; for(int z = 0; z < wCntZ; ++z) { for(int x = 0; x < wCntX; ++x) { iIndex = z * wCntX + x; pVtxTex[iIndex].vPos = D3DXVECTOR3( float(x) * wItv , (pdwPixel[iIndex] & 0x000000ff) / 5.f , float(z) * wItv); pVtxTex[iIndex].vNormal = D3DXVECTOR3(0.f, 0.f, 0.f); pVtxTex[iIndex].vTexUV = D3DXVECTOR2( x / (wCntX - 1.f), z / (wCntZ - 1.f) ); } } INDEX16* pIndex = NULL; m_pIB->Lock(0, 0, (void**)&pIndex, 0); int iTriCnt = 0; for(int z = 0; z < wCntZ - 1; ++z) { for(int x = 0; x < wCntX - 1; ++x) { iIndex = z * wCntX + x; pIndex[iTriCnt]._1 = iIndex + wCntX; //1-2 pIndex[iTriCnt]._2 = iIndex + wCntX + 1; // /| pIndex[iTriCnt]._3 = iIndex + 1; // 3 D3DXVECTOR3 vDest, vSour, vNormal; vDest = pVtxTex[ pIndex[iTriCnt]._2 ].vPos - pVtxTex[ pIndex[iTriCnt]._1 ].vPos; vSour = pVtxTex[ pIndex[iTriCnt]._3 ].vPos - pVtxTex[ pIndex[iTriCnt]._2 ].vPos; D3DXVec3Cross(&vNormal, &vDest, &vSour); pVtxTex[ pIndex[iTriCnt]._1 ].vNormal += vNormal; pVtxTex[ pIndex[iTriCnt]._2 ].vNormal += vNormal; pVtxTex[ pIndex[iTriCnt]._3 ].vNormal += vNormal; ++iTriCnt; pIndex[iTriCnt]._1 = iIndex + wCntX; pIndex[iTriCnt]._2 = iIndex + 1; pIndex[iTriCnt]._3 = iIndex; vDest = pVtxTex[ pIndex[iTriCnt]._2 ].vPos - pVtxTex[ pIndex[iTriCnt]._1 ].vPos; vSour = pVtxTex[ pIndex[iTriCnt]._3 ].vPos - pVtxTex[ pIndex[iTriCnt]._2 ].vPos; D3DXVec3Cross(&vNormal, &vDest, &vSour); pVtxTex[ pIndex[iTriCnt]._1 ].vNormal += vNormal; pVtxTex[ pIndex[iTriCnt]._2 ].vNormal += vNormal; pVtxTex[ pIndex[iTriCnt]._3 ].vNormal += vNormal; ++iTriCnt; } } for(_ushort i = 0; i < m_dwVtxCnt; ++i) { D3DXVec3Normalize(&pVtxTex[i].vNormal, &pVtxTex[i].vNormal); } m_pVB->Unlock(); m_pIB->Unlock(); Engine::Safe_Delete_Array(pdwPixel); return S_OK;}
开发者ID:chanona,项目名称:Guardians,代码行数:98,
示例3: D3DXVECTOR3void InBuilding::build(float w, float h, float d){ VertexPNTList vertices; VertexPNT v; float width = w; float height = h; float depth = d; float thrirdwidth = w/3; float twothirdwidth = (2*w)/3; float twothirdheight = (2*h)/3; //Front v.normal = D3DXVECTOR3( 0.0f, 0.0f, -1.0f); v.pos = D3DXVECTOR3(0.1f, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, height, 0.1f); v.texC = D3DXVECTOR2(0.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(thrirdwidth, height, 0.1f); v.texC = D3DXVECTOR2(0.4,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(thrirdwidth, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.4,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(thrirdwidth, twothirdheight, 0.1f); v.texC = D3DXVECTOR2(0.4,0.7); vertices.push_back(v); v.pos = D3DXVECTOR3(twothirdwidth, twothirdheight, 0.1f); v.texC = D3DXVECTOR2(0.8,0.7); vertices.push_back(v); v.pos = D3DXVECTOR3(twothirdwidth, height, 0.1f); v.texC = D3DXVECTOR2(0.8,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, height, 0.1f); v.texC = D3DXVECTOR2(1.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, 0.1f, 0.1f); v.texC = D3DXVECTOR2(1.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(twothirdwidth, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.8,0.0); vertices.push_back(v); //Left Face v.normal = D3DXVECTOR3( -1.0f, 0.0f, 0.0f); v.pos = D3DXVECTOR3(0.1f, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, height, 0.1f); v.texC = D3DXVECTOR2(0.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, height, depth); v.texC = D3DXVECTOR2(1.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, 0.1f, depth); v.texC = D3DXVECTOR2(1.0,0.0); vertices.push_back(v); //Top v.normal = D3DXVECTOR3( 0.0f, 1.0f, 0.0f); v.pos = D3DXVECTOR3(0.1f, height, 0.1f); v.texC = D3DXVECTOR2(0.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, height, depth); v.texC = D3DXVECTOR2(0.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, height, depth); v.texC = D3DXVECTOR2(1.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, height, 0.1f); v.texC = D3DXVECTOR2(1.0,0.0); vertices.push_back(v); //Right v.normal = D3DXVECTOR3( 1.0f, 0.0f, 0.0f); v.pos = D3DXVECTOR3(width, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, 0.1f, depth); v.texC = D3DXVECTOR2(0.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, height, depth); v.texC = D3DXVECTOR2(1.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, height, 0.1f); v.texC = D3DXVECTOR2(1.0,0.0); vertices.push_back(v); //Bottom v.normal = D3DXVECTOR3( 0.0f, -1.0f, 0.0f); v.pos = D3DXVECTOR3(0.1f, 0.1f, 0.1f); v.texC = D3DXVECTOR2(0.0,0.0); vertices.push_back(v); v.pos = D3DXVECTOR3(0.1f, 0.1f, depth); v.texC = D3DXVECTOR2(0.0,1.0); vertices.push_back(v); v.pos = D3DXVECTOR3(width, 0.1f, depth); v.texC = D3DXVECTOR2(1.0,1.0); vertices.push_back(v);//.........这里部分代码省略.........
开发者ID:jcrm,项目名称:DX,代码行数:101,
示例4: D3DXVECTOR3bool ModelClass::InitializeBuffers(ID3D11Device* device){ VertexType* vertices; unsigned long* indices; D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc; D3D11_SUBRESOURCE_DATA vertexData, indexData; HRESULT result; // Set the number of vertices in the vertex array. m_vertexCount = 3; // Set the number of indices in the index array. m_indexCount = 3; // Create the vertex array. vertices = new VertexType[m_vertexCount]; if(!vertices) { return false; } // Create the index array. indices = new unsigned long[m_indexCount]; if(!indices) { return false; } // Load the vertex array with data. vertices[0].position = D3DXVECTOR3(-1.0f, -1.0f, 0.0f); // Bottom left. vertices[0].texture = D3DXVECTOR2(0.0f, 1.0f); vertices[1].position = D3DXVECTOR3(0.0f, 1.0f, 0.0f); // Top middle. vertices[1].texture = D3DXVECTOR2(0.5f, 0.0f); vertices[2].position = D3DXVECTOR3(1.0f, -1.0f, 0.0f); // Bottom right. vertices[2].texture = D3DXVECTOR2(1.0f, 1.0f); // Load the index array with data. indices[0] = 0; // Bottom left. indices[1] = 1; // Top middle. indices[2] = 2; // Bottom right. // Set up the description of the static vertex buffer. vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT; vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount; vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; vertexBufferDesc.CPUAccessFlags = 0; vertexBufferDesc.MiscFlags = 0; vertexBufferDesc.StructureByteStride = 0; // Give the subresource structure a pointer to the vertex data. vertexData.pSysMem = vertices; vertexData.SysMemPitch = 0; vertexData.SysMemSlicePitch = 0; // Now create the vertex buffer. result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer); if(FAILED(result)) { return false; } // Set up the description of the static index buffer. indexBufferDesc.Usage = D3D11_USAGE_DEFAULT; indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount; indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.MiscFlags = 0; indexBufferDesc.StructureByteStride = 0; // Give the subresource structure a pointer to the index data. indexData.pSysMem = indices; indexData.SysMemPitch = 0; indexData.SysMemSlicePitch = 0; // Create the index buffer. result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer); if(FAILED(result)) { return false; } // Release the arrays now that the vertex and index buffers have been created and loaded. delete [] vertices; vertices = 0; delete [] indices; indices = 0; return true;}
开发者ID:Scillman,项目名称:rastertek-dx11-tutorials,代码行数:93,
示例5: D3DXVECTOR2void Warlock::Intro(){ float x = this->mGe->GetEngineParameters().windowWidth * 0.5f - this->mGe->GetEngineParameters().windowWidth * 0.2125f; float y = this->mGe->GetEngineParameters().windowHeight * 0.4f; Text* intro = mGe->CreateText("Warlock", D3DXVECTOR2(x, y), 2.0f, "Media/Fonts/1"); mGe->LoadingScreen("Media/LoadingScreen/LoadingScreenBG.png", "Media/LoadingScreen/LoadingScreenPB.png", 0.0f, 1.0f, 1.0f, 1.0f); // Changed by MaloW intro->SetText(""); mGe->DeleteText(intro); float width = GetGraphicsEngine()->GetEngineParameters().windowWidth; float height = GetGraphicsEngine()->GetEngineParameters().windowHeight; /* Set hud */ this->mHud[0] = NULL; this->mHud[1] = NULL; this->mHud[2] = NULL; this->mHud[3] = NULL; this->mHud[4] = NULL; this->mHud[5] = NULL; this->mHud[6] = NULL; this->mHud[7] = NULL; this->mHud[8] = NULL; this->mHud[9] = NULL; this->mHud[10] = NULL; // Rework ScreenWidth to 4:3 const float UISCALE = 0.5f; float screenHeight = this->mGe->GetEngineParameters().windowHeight; float screenWidth = (screenHeight * 4) / 3; float distX = (mGe->GetEngineParameters().windowWidth - screenWidth) / 2; distX /= UISCALE; D3DXVECTOR2 imgDim = D3DXVECTOR2(screenWidth / 5, screenWidth / 5) * UISCALE; distX = (this->mGe->GetEngineParameters().windowWidth / 2.0f) - ((imgDim.x * 5.0f) / 2.0f); for(int i = 11; i < 16; i++) { this->mHud[i] = mGe->CreateText("",D3DXVECTOR2(distX + imgDim.x * (i-11) + (imgDim.x * 0.2f), screenHeight - imgDim.y * 0.65f), 1.0f, "Media/Fonts/1"); } this->mHud[16] = NULL; this->mProgressBars = new ProgressBar*[6]; float percentX = 0.02f; float percentY = 0.88f; for(int i = 0; i<5;i++) { D3DXVECTOR2 temp = D3DXVECTOR2(percentX,percentY); this->mProgressBars[i] = new ProgressBar(distX + imgDim.x * i, screenHeight - imgDim.y - (screenHeight * 0.03f), imgDim.x, (screenHeight * 0.03f)); this->mProgressBars[i]->SetPercentOfProgressBarColor1(0.0f); this->mProgressBars[i]->SetPercentOfProgressBarColor2(0.0f); this->mProgressBars[i]->SetPercentOfProgressBarColor3(0.0f); this->mProgressBars[i]->SetPercentOfProgressBarColor4(0.0f); percentX = percentX + 0.16f; } D3DXVECTOR2 temp = D3DXVECTOR2(percentX,percentY); this->mProgressBars[5] = new ProgressBar(distX, screenHeight - imgDim.y - (screenHeight * 0.08f) , imgDim.x * 5.0f, (screenHeight * 0.05f)); this->mProgressBars[5]->SetPercentOfProgressBarColor1(0.0f); this->mProgressBars[5]->SetPercentOfProgressBarColor2(0.0f); this->mProgressBars[5]->SetPercentOfProgressBarColor3(0.0f); this->mProgressBars[5]->SetPercentOfProgressBarColor4(0.0f); percentX = percentX + 0.16f; this->mTimeElapsedText = this->mGe->CreateText( "", D3DXVECTOR2(15.0f, 10.0f), 1.0f, "Media/Fonts/1"); // Add spell Icons Image* charge = mGe->CreateImage(D3DXVECTOR2(distX, screenHeight - imgDim.y), imgDim, "Media/WarlockUI/ChargeIcon.png"); Image* sprint = mGe->CreateImage(D3DXVECTOR2(distX + imgDim.x, screenHeight - imgDim.y), imgDim, "Media/WarlockUI/SprintIcon.png"); Image* harden = mGe->CreateImage(D3DXVECTOR2(distX + imgDim.x * 2, screenHeight - imgDim.y), imgDim, "Media/WarlockUI/HardenIcon.png"); Image* invis = mGe->CreateImage(D3DXVECTOR2(distX + imgDim.x * 3, screenHeight - imgDim.y), imgDim, "Media/WarlockUI/InvisIcon.png"); Image* jump = mGe->CreateImage(D3DXVECTOR2(distX + imgDim.x * 4, screenHeight - imgDim.y), imgDim, "Media/WarlockUI/JumpIcon.png"); this->SpellIcons.add(charge); this->SpellIcons.add(sprint); this->SpellIcons.add(harden); this->SpellIcons.add(invis); this->SpellIcons.add(jump);}
开发者ID:Malow,项目名称:PowerBall,代码行数:91,
示例6: D3DXVECTOR3bool Model::InitBuffers(ID3D11Device* device){ Vertex* vertices; unsigned long* indices; D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc; D3D11_SUBRESOURCE_DATA vertexData, indexData; HRESULT result; int i; //new to 0.6 for counter // Create vertex array. vertices = new Vertex[_vertexCount]; // longer set to 3. new to 0.6 // Create index array. indices = new unsigned long[_indexCount]; // longer set to 3. new to 0.6 // Load vertex array and index array with data. new to 0.6 for(i=0; i<_vertexCount; i++) { vertices[i].position = D3DXVECTOR3(_model[i].x+20, _model[i].y, _model[i].z+60); vertices[i].texture = D3DXVECTOR2(_model[i].tu, _model[i].tv); vertices[i].normal = D3DXVECTOR3(_model[i].nx, _model[i].ny, _model[i].nz); indices[i] = i; } // Set up description of static vertex buffer. vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT; vertexBufferDesc.ByteWidth = sizeof(Vertex) * _vertexCount; vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; vertexBufferDesc.CPUAccessFlags = 0; vertexBufferDesc.MiscFlags = 0; vertexBufferDesc.StructureByteStride = 0; // Give subresource structure a pointer to vertex data. vertexData.pSysMem = vertices; vertexData.SysMemPitch = 0; vertexData.SysMemSlicePitch = 0; // Now create vertex buffer. result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &_vertexBuffer); if(FAILED(result)) { return false; } // Set up description of static index buffer. indexBufferDesc.Usage = D3D11_USAGE_DEFAULT; indexBufferDesc.ByteWidth = sizeof(unsigned long) * _indexCount; indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.MiscFlags = 0; indexBufferDesc.StructureByteStride = 0; // Give subresource structure a pointer to index data. indexData.pSysMem = indices; indexData.SysMemPitch = 0; indexData.SysMemSlicePitch = 0; // Create index buffer. result = device->CreateBuffer(&indexBufferDesc, &indexData, &_indexBuffer); if(FAILED(result)) { return false; } //once ind and vert buffers been created arrays no longer needed as data in buffers // Release arrays now that vertex and index buffers have been created and loaded. delete [] vertices; vertices = 0; delete [] indices; indices = 0; return true;}
开发者ID:makehimanoffer,项目名称:3rdYearProjectStorage,代码行数:76,
示例7: D3DXVECTOR3bool ModelClass::InitializeBuffers(ID3D10Device* device){ VertexType* vertices; unsigned long* indices; D3D10_BUFFER_DESC vertexBufferDesc, indexBufferDesc; D3D10_SUBRESOURCE_DATA vertexData, indexData; HRESULT result; int i; // Create the vertex array. vertices = new VertexType[m_vertexCount]; if(!vertices) { return false; } // Create the index array. indices = new unsigned long[m_indexCount]; if(!indices) { return false; } // Load the vertex array and index array with data. for(i=0; i<m_vertexCount; i++) { vertices[i].position = D3DXVECTOR3(m_model[i].x, m_model[i].y, m_model[i].z); vertices[i].texture = D3DXVECTOR2(m_model[i].tu, m_model[i].tv); indices[i] = i; } // Set up the description of the vertex buffer. vertexBufferDesc.Usage = D3D10_USAGE_DEFAULT; vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount; vertexBufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER; vertexBufferDesc.CPUAccessFlags = 0; vertexBufferDesc.MiscFlags = 0; // Give the subresource structure a pointer to the vertex data. vertexData.pSysMem = vertices; // Now finally create the vertex buffer. result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer); if(FAILED(result)) { return false; } // Set up the description of the index buffer. indexBufferDesc.Usage = D3D10_USAGE_DEFAULT; indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount; indexBufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER; indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.MiscFlags = 0; // Give the subresource structure a pointer to the index data. indexData.pSysMem = indices; // Create the index buffer. result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer); if(FAILED(result)) { return false; } // Release the arrays now that the vertex and index buffers have been created and loaded. delete [] vertices; vertices = 0; delete [] indices; indices = 0; return true;}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:76,
示例8: chainDirvoid ElBillboardChain::_setupVertices(ElCamera* cam){ D3DXVECTOR3 chainDir(0.0f, 0.0f, 0.0f); if (!mChainElementList.empty()) chainDir = mChainElementList.back().position - mChainElementList.begin()->position; int numElements = (int)mChainElementList.size(); int lastElement = numElements - 1; for (int i = 0; i < numElements; ++i) { Element prevElement, nextElement; if (i != lastElement) { prevElement = mChainElementList[i]; nextElement = mChainElementList[i + 1]; } else if (i != 0) { prevElement = mChainElementList[i - 1]; nextElement = mChainElementList[i]; } else { prevElement = nextElement = mChainElementList[i]; } D3DXVECTOR3 segmentDir; if (mUseChainDirection) segmentDir = chainDir; else segmentDir = nextElement.position - prevElement.position; D3DXVECTOR3 lookAt(0.0f, 0.0f, 1.0f); if (cam) lookAt = -cam->getDirection(); D3DXVECTOR3 strechDir; D3DXVec3Cross(&strechDir, &lookAt, &segmentDir); D3DXVec3Normalize(&strechDir, &strechDir); // each element can be extended to two vertices, according to positions of // its neighbors and itself Element currentElement = mChainElementList[i]; int vertexIdx = i * 2; mVertices[vertexIdx].pos = currentElement.position + (currentElement.width * strechDir); mVertices[vertexIdx].color = currentElement.colour; if (mTexCoordMode == TextCoord_CustomX) mVertices[vertexIdx].tex = D3DXVECTOR2(currentElement.texCoord, 1.0f); else if (mTexCoordMode == TextCoord_CustomY) mVertices[vertexIdx].tex = D3DXVECTOR2(1.0f, currentElement.texCoord); ++vertexIdx; mVertices[vertexIdx].pos = currentElement.position - (currentElement.width * strechDir); mVertices[vertexIdx].color = currentElement.colour; if (mTexCoordMode == TextCoord_CustomX) mVertices[vertexIdx].tex = D3DXVECTOR2(currentElement.texCoord, 0.0f); else if (mTexCoordMode == TextCoord_CustomY) mVertices[vertexIdx].tex = D3DXVECTOR2(0.0f, currentElement.texCoord); }}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:61,
示例9: D3DXVECTOR3//.........这里部分代码省略......... if (workBlockPos2.y - blockSize.y < blockPos.y + blockSize.y && workBlockPos2.y + blockSize.y > blockPos.y - blockSize.y && workBlockPos2.x - blockSize.x < blockPos.x + blockSize.x && workBlockPos2.x + blockSize.x > blockPos.x - blockSize.x && workBlockPos2.x - blockPos.x > -BLOCK_WIDTH && workBlockPos2.x - blockPos.x < 0.0f) { workBlockPos2.x = blockPos.x - blockSize.x - BLOCK_WIDTH; workBlockPos2.y = blockPos.y - blockSize.y; pBlock->SetPosition(workBlockPos2); CBlockManager::CalculateBlockArrayNum(workBlockPos2, &nWorkBlockArrayNumX, &nWorkBlockArrayNumY); if (nWorkBlockArrayNumX != nArrayNumX - 1) { CBlockManager::SetBlock(nWorkBlockArrayNumX, nWorkBlockArrayNumY, pBlock); CBlockManager::SetBlock(nArrayNumX - 1, nArrayNumY, nullptr); } } } } // 落下していき、配列番号が C++ D3DXVECTOR3函数代码示例 C++ D3DXMatrixTranspose函数代码示例
|