本文整理汇总了C++中ogl::CObject::getShape方法的典型用法代码示例。如果您正苦于以下问题:C++ CObject::getShape方法的具体用法?C++ CObject::getShape怎么用?C++ CObject::getShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogl::CObject
的用法示例。
在下文中一共展示了CObject::getShape方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_objects
void init_objects()
{
{ // plane
ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
pObjectBuilder->setWidth(10.0f);
pObjectBuilder->setHeight(10.0f);
pObjectBuilder->setSubdivisions(10);
//pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::REPEAT_UV);
pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::TANGENTS);
//pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
pObjectP = pObjectBuilder->build();
ogl::CDdsTextureBuilder* pTextureBuilder = new ogl::CDdsTextureBuilder;
pTextureBuilder->setFile("ground/rocks_d.dds");
pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTextureBuilder->build());
pTextureBuilder->setFile("ground/rocks_h.dds");
pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::HEIGHT, pTextureBuilder->build()); // displacement
delete pObjectBuilder;
}
{
ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
pObjectBuilder->setFile("monkey/monkey.obj");
pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
pObject0 = pObjectBuilder->build();
pObject0->setM(math::translate(0.0f, 2.0f, 0.0f) * math::rotate(-90.0f, math::X));
delete pObjectBuilder;
}
}
示例2: init_objects
void init_objects()
{
{ // plane
ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
pObjectBuilder->setWidth(20.0f);
pObjectBuilder->setHeight(20.0f);
pObjectBuilder->setSubdivisions(1);
// pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
pObjectP = pObjectBuilder->build();
delete pObjectBuilder;
}
{ // box from box-builder
// ogl::CBoxObjectBuilder* pObjectBuilder = new ogl::CBoxObjectBuilder;
// pObjectBuilder->setWidth(1.0f);
// pObjectBuilder->setHeight(1.0f);
// pObjectBuilder->setDepth(1.0f);
// pObject = pObjectBuilder->build();
// pObject->setM(math::translate(0.0f, -1.0f, 5.0f) * math::scale(10.0f));
// delete pObjectBuilder;
}
{ // random mesh
ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
pObjectBuilder->setFile("box/box.obj");
pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
pObject1 = pObjectBuilder->build();
pObject1->setM(math::translate(0.0f, 0.0f, 2.0f));
delete pObjectBuilder;
}
{ // skybox
ogl::CAssimpObjectBuilder* pObjectBuilder = new ogl::CAssimpObjectBuilder;
pObjectBuilder->setFile("skybox/skydome.obj");
pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
pObjectS = pObjectBuilder->build();
pObjectS->setM(math::scale(20.0f));
delete pObjectBuilder;
}
{ // billboarding
ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
pObjectBuilder->setWidth(18.0f);
pObjectBuilder->setHeight(18.0f);
pObjectBuilder->setSubdivisions(6);
// pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
pObjectB = pObjectBuilder->build();
delete pObjectBuilder;
ogl::CPngTextureBuilder* pTextureBuilder = new ogl::CPngTextureBuilder;
pTextureBuilder->setFile("monster.png");
ogl::CTexture* pTexture = pTextureBuilder->build();
pTexture->setWrapping(ogl::CTexture::EWrapping::CLAMP_TO_BORDER);
delete pTextureBuilder;
ogl::CMaterial* pMaterial = new ogl::CMaterial;
pMaterial->setTexture(ogl::CTexture::EScope::DIFFUSE, pTexture);
pObjectB->setMode(GL_POINTS);
pObjectB->getShape(0)->setMaterial(pMaterial);
}
}
示例3: init_objects
void init_objects()
{
sys::info << "app::COGLDev42PCFShadowMapApp::init_objects()" << sys::endl;
{ // plane
ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
pObjectBuilder->setWidth(25.0f);
pObjectBuilder->setHeight(25.0f);
pObjectBuilder->setSubdivisions(10);
pObjectBuilder->setTextureScale(0.5f);
pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::REPEAT_UV);
pObjectBuilder->addOption(ogl::CObjectBuilder::TANGENTS);
// pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
pObjectP = pObjectBuilder->build();
ogl::CTgaTextureBuilder* pTgaTextureBuilder = new ogl::CTgaTextureBuilder;
ogl::CDdsTextureBuilder* pDdsTextureBuilder = new ogl::CDdsTextureBuilder;
pTgaTextureBuilder->setFile("ground/concrete_d.tga");
pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTgaTextureBuilder->build());
pTgaTextureBuilder->setFile("ground/concrete_n.tga");
pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::NORMALS, pTgaTextureBuilder->build()); // normals
pDdsTextureBuilder->setFile("skybox/planet.dds");
pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::ENVIRONMENT, pDdsTextureBuilder->build());
// pObjectP->translate(math::vec3(0.0f, -3.0f, 0.0f));
// TODO: move this inside CObject or in a CObjectBuilder
ogl::CTransformHistory::getInstance()->set(pObjectP, ogl::CTransform(pObjectP->mScale, pObjectP->mOrientation, pObjectP->mPosition));
glExitIfError();
delete pTgaTextureBuilder;
delete pDdsTextureBuilder;
delete pObjectBuilder;
}
{ // box
ogl::CBoxObjectBuilder* pObjectBuilder = new ogl::CBoxObjectBuilder;
pObjectBuilder->setWidth(10.0f);
pObjectBuilder->setHeight(10.0f);
pObjectBuilder->setDepth(10.0f);
pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
pObjectBuilder->setTextureScale(0.5f);
//pObjectBuilder->addOption(ogl::CObjectBuilder::FLATFACE);
pObjectB = pObjectBuilder->build();
ogl::CTgaTextureBuilder* pTgaTextureBuilder = new ogl::CTgaTextureBuilder;
ogl::CDdsTextureBuilder* pDdsTextureBuilder = new ogl::CDdsTextureBuilder;
pTgaTextureBuilder->setFile("tiles/pavers_d.tga");
pObjectB->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTgaTextureBuilder->build());
pTgaTextureBuilder->setFile("tiles/pavers_n.tga");
pObjectB->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::NORMALS, pTgaTextureBuilder->build()); // normals
pDdsTextureBuilder->setFile("skybox/skydome.dds");
pObjectB->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::ENVIRONMENT, pDdsTextureBuilder->build());
pObjectB->translate(math::vec3(0.0f, 5.0f, 0.0f));
glExitIfError();
delete pTgaTextureBuilder;
delete pDdsTextureBuilder;
delete pObjectBuilder;
}
{ // boblampclean
ogl::CMd5ObjectBuilder* pObjectBuilder = new ogl::CMd5ObjectBuilder;
pObjectBuilder->setFile("boblampclean/boblampclean.md5mesh");
pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
//pObjectBuilder->addOption(ogl::CObjectBuilder::ADJACENCY); // TODO: unfuck up the MD5 parser
pObject0 = pObjectBuilder->build();
ogl::CTgaTextureBuilder* pTextureBuilder = new ogl::CTgaTextureBuilder;
pTextureBuilder->setFile("boblampclean/guard1_body_n.tga");
// sys::info << sys::tab << "set normal to shape: " << pObject0->getShape(0)->getName() << sys::endl;
pObject0->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::NORMALS, pTextureBuilder->build());
// TODO: need better normalization
pObject0->scale(2.0f);
pObject0->rotate(math::quat(-90.0f, math::X) * math::quat(180.0f, math::Z));
// Remember previous transformation
ogl::CTransformHistory::getInstance()->set(pObject0, ogl::CTransform(pObject0->mScale, pObject0->mOrientation, pObject0->mPosition));
glExitIfError();
delete pObjectBuilder;
delete pTextureBuilder;
}
{ // another box
ogl::CMd5ObjectBuilder* pObjectBuilder = new ogl::CMd5ObjectBuilder;
pObjectBuilder->setFile("cube.md5mesh");
pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
pObject1 = pObjectBuilder->build();
pObject1->scale(0.5f);
pObject1->translate(math::vec3(4.0f, 5.0f, 1.0f));
ogl::CTransformHistory::getInstance()->set(pObject1, ogl::CTransform(pObject1->mScale, pObject1->mOrientation, pObject1->mPosition));
delete pObjectBuilder;
}
}