//******************************************************************************* void CWaterEnvMap::renderTestMesh(IDriver &driver) { doInit(); CMaterial testMat; testMat.setLighting(false); testMat.texEnvOpRGB(0, CMaterial::Modulate); testMat.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor); testMat.texEnvArg0RGB(1, CMaterial::Diffuse, CMaterial::SrcColor); testMat.texEnvOpAlpha(0, CMaterial::Replace); testMat.texEnvArg0Alpha(0, CMaterial::Constant, CMaterial::SrcAlpha); testMat.texConstantColor(0, CRGBA(255, 255, 255, 255)); testMat.setDoubleSided(true); testMat.setZWrite(false); testMat.setZFunc(CMaterial::always); // tmp : test cubemap driver.activeVertexProgram(&testMeshVP); driver.activeVertexBuffer(_TestVB); driver.activeIndexBuffer(_TestIB); driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); // tmp _MaterialPassThruZTest.setTexture(0, _EnvCubic); driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); driver.setConstant(4, 2.f, 1.f, 0.f, 0.f); //driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS); driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS); driver.activeVertexProgram(NULL); }
// *************************************************************************** void CScene::renderOcclusionTestMeshs() { nlassert(RenderTrav.getDriver()); RenderTrav.getDriver()->setupViewport(RenderTrav.getViewport()); RenderTrav.getDriver()->activeVertexProgram(NULL); RenderTrav.getDriver()->activePixelProgram(NULL); RenderTrav.getDriver()->activeGeometryProgram(NULL); IDriver::TPolygonMode oldPolygonMode = RenderTrav.getDriver()->getPolygonMode(); CMaterial m; m.initUnlit(); m.setColor(CRGBA(255, 255, 255, 127)); m.setBlend(true); m.setDstBlend(CMaterial::invsrcalpha); m.setSrcBlend(CMaterial::srcalpha); m.setZWrite(false); RenderTrav.getDriver()->setupMaterial(m); getDriver()->setPolygonMode(IDriver::Filled); renderOcclusionTestMeshsWithCurrMaterial(); m.setColor(CRGBA::Black); RenderTrav.getDriver()->setupMaterial(m); getDriver()->setPolygonMode(IDriver::Line); renderOcclusionTestMeshsWithCurrMaterial(); getDriver()->setPolygonMode(oldPolygonMode); }