本文整理汇总了C++中VertexShader::isParam方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexShader::isParam方法的具体用法?C++ VertexShader::isParam怎么用?C++ VertexShader::isParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexShader
的用法示例。
在下文中一共展示了VertexShader::isParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawImage
bool World::drawImage(RenderFrame* pRenderFrame,RenderMesh* pRenderMesh)
{
//デバイスの状況チェック
if(!isDeviceActive())
return false;
IDirect3DDevice9* pd3dDevice = Device::getInterface();
if(!pd3dDevice)
return false;
Mesh* mesh = pRenderMesh->mesh;
if(!mesh)
return false;
RenderFrame* renderFrame = pRenderMesh->renderFrame;
Vertex* vertex = mesh->getVertexBuffer();
if(!vertex)
return false;
IDirect3DVertexBuffer9* pVertexBuffer = vertex->getInterface();
if(!pVertexBuffer)
return false;
Index* index = mesh->getIndexBuffer();
IDirect3DIndexBuffer9* pIndexBuffer = index?index->getInterface():NULL;
RenderUnit* renderUnit = renderFrame->renderUnit;
Unit* unit = renderUnit->unit;
bool shaderFlag = mesh->isShader();
//ビュークリップ
if(unit->isViewClip())
{
RECT& viewRect = renderFrame->renderUnit->clipRect;
if(viewRect.top >= viewRect.bottom || viewRect.left >= viewRect.right)
return true;
NVector box1 = {(FLOAT)viewRect.left,(FLOAT)viewRect.top,0,1};
NVector box2 = {(FLOAT)viewRect.right,(FLOAT)viewRect.top,0,1};
NVector box3 = {(FLOAT)viewRect.left,(FLOAT)viewRect.bottom,0,1};
NVector out1 = box1.transformCoord(renderFrame->matrix);
NVector out2 = box2.transformCoord(renderFrame->matrix);
NVector out3 = box3.transformCoord(renderFrame->matrix);
Device::setClipper(
out1.x,out1.y,out1.z,
out2.x,out2.y,out2.z,
out3.x,out3.y,out3.z);
}
//座標の設定
if(shaderFlag)
{
VertexShader* vertexShader = mesh->getVertexShader();
Device::getInterface()->SetVertexShader(*vertexShader);
//シェーダ
NMatrix matrix[100];
NMatrix* matView;
NMatrix* matProj;
NMatrix matWork;
if(m_camera)
{
if(unit->isView2D())
{
matView = &m_camera->getBaseView();
pd3dDevice->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE);
}
else
{
matView = &m_camera->getView();
pd3dDevice->SetRenderState(D3DRS_CULLMODE,m_camera->getCull());
}
matProj = &m_camera->getProjection();
}
vertexShader->setDefaultParam();
Material* material = mesh->getMaterial();
vertexShader->setParam("MaterialDiffuse",&material->Diffuse);
vertexShader->setParam("MaterialAmbient",&material->Ambient);
vertexShader->setParam("View",matView);
vertexShader->setParam("Proj",matProj);
vertexShader->setParam("World",&renderFrame->matrix);
if(vertexShader->isParam("LightDir"))
{
if(unit->isLight())
{
NVector v = {0.1f,-0.5f,-0.5f,0.0f};
vertexShader->setParam("LightDir",&v);
}
else
{
static NVector v = {0,0,0};
vertexShader->setParam("LightDir",&v);
}
}
if(vertexShader->isParam("WorldView") || vertexShader->isParam("WorldViewProj"))
{
matWork = renderFrame->matrix * *matView;
vertexShader->setParam("WorldView",&matWork);
//.........这里部分代码省略.........