本文整理汇总了C++中Renderable::saveMatrixInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::saveMatrixInfo方法的具体用法?C++ Renderable::saveMatrixInfo怎么用?C++ Renderable::saveMatrixInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::saveMatrixInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void Shadows::init(WidgetRenderer * renderer, Camera& myCam, DebugMenuManager * menu) {
myCam.lookAt(glm::vec3(-30,20,0),glm::vec3());
viewCamera = &myCam;
sceneCam = *viewCamera;
depthPower = 50;
specPower = 100;
thres = .0005f;
lightColor = glm::vec3(.5,.5,.5);
biasMatrix = glm::mat4 (
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0
);
ShaderProgram * shadowShader = renderer->addShader("./../shaders/Shadow_V.glsl","./../shaders/Shadow_F.glsl");
renderer->saveViewTransform(shadowShader,"viewTransform");
//setup scene
GeometryInfo * planeGeo = renderer->addGeometry(Neumont::ShapeGenerator::makePlane(2));
GeometryInfo * objectGeo = renderer->addGeometry(NUShapeEditor::setRandomColor(NUShapeEditor::overrideColorWithTanNormals(Neumont::ShapeGenerator::makeTeapot(20,glm::mat4())),3));
Renderable * mePlane = setupRenderable(renderer->addRenderable(planeGeo,shadowShader));
mePlane->transformData.scale = glm::vec3(50,50,50);
mePlane->transformData.position = glm::vec3(25,0,25);
Renderable * meObject = setupRenderable(renderer->addRenderable(objectGeo,shadowShader));
meObject->transformData.position.y = 1;
meObject->transformData.position.z = -4;
meObject->transformData.setScale(4);
meObject->transformData.rotation.x = -90;
//save into passInfo
shadowMap = renderer->addPassInfo(true);
shadowMap->initTextures(renderer->width(),renderer->height());
shadowMap->cam.enabled = true;
shadowMap->cam.lookAt(glm::vec3(0,20,-40),glm::vec3());
shadowShader->saveUniform("shadowMap",ParameterType::PT_TEXTURE, &shadowMap->depthTexture);
shadowShader->saveUniform("lightColor", lightColor);
shadowShader->saveUniform("diffusePos", shadowMap->cam.getPos());
shadowShader->saveUniform("specPower", specPower);
shadowShader->saveUniform("camPos", myCam.getPos());
shadowShader->saveUniform("camLookAt", shadowMap->cam.getWorld2View());
shadowShader->saveUniform("biasMatrix", biasMatrix);
shadowShader->saveUniform("thres", thres);
renderer->savePerspectiveMat(shadowShader,"perspectiveMat");
lightRenderable = renderer->addRenderable(renderer->addGeometry(Neumont::ShapeGenerator::makeSphere(20)),renderer->defaultShaders.passThroughColor);
lightRenderable->saveMatrixInfo("model2WorldTransform");
//setting up debugScreen
ShaderProgram * screenSpaceHeros = renderer->addShader("./../shaders/ScreenSpace_V.glsl","./../shaders/ScreenSpace_F.glsl");
renderer->saveViewTransform(screenSpaceHeros,"viewTransform");
GeometryInfo * displayPlaneGeo = renderer->addGeometry(NUShapeEditor::rotate(NUShapeEditor::scaleToRange(Neumont::ShapeGenerator::makePlane(2),.3,.3,.3),90,0,0));
Renderable * depthPlane = renderer->addRenderable(displayPlaneGeo,screenSpaceHeros, shadowMap->depthTexture);
depthPlane->transformData.position = glm::vec3(1,.7,-1);
depthPlane->saveMatrixInfo("meTransform");
depthPlane->saveTexture("myTexture");
depthPlane->addUniformParameter("power",depthPower);
menu->setSliderGranularity(100000);
menu->edit("Set Cam As Light",camIsLight);
menu->edit("thres",thres,0,.001);
menu->edit("nearPlane",renderer->nearPlane,0,.1);
menu->edit("farPlane",renderer->farPlane,10,100);
}