本文整理汇总了C++中IScene::add方法的典型用法代码示例。如果您正苦于以下问题:C++ IScene::add方法的具体用法?C++ IScene::add怎么用?C++ IScene::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScene
的用法示例。
在下文中一共展示了IScene::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Camera::Camera (const std::string &name) :
SceneObject(),
m_Float4Props(COUNT_FLOAT4PROPERTY),
m_FloatProps(COUNT_FLOATPROPERTY),
m_Mat4Props(COUNT_MAT4PROPERTY),
m_IsDynamic (false),
m_pViewport (0),
m_LookAt(false),
m_LookAtPoint(0.0f, 0.0f, 0.0f),
m_Spherical((float)M_PI,0.0f),
m_PositionOffset (0.0f),
m_IsOrtho (false)
{
//mFloatAttribs.add(AttribFloat(FOV, 60.0f));
//mFloatAttribs.add(AttribFloat(NEARP, 1.0f));
//mFloatAttribs.add(AttribFloat(FARP, 10000.0f));
//mFloatAttribs.add(AttribFloat(LEFT, -1.0f));
//mFloatAttribs.add(AttribFloat(RIGHT, 1.0f));
//mFloatAttribs.add(AttribFloat(TOP, 1.0f));
//mFloatAttribs.add(AttribFloat(BOTTOM, -1.0f));
//mVec4Attribs.add(AttribVec4(POSITION, 0.0f, 0.0f, 0.0f, 1.0f));
//mVec4Attribs.add(AttribVec4(VIEW_VEC, 0.0f, 0.0f, -1.0f, 0.0f));
//mVec4Attribs.add(AttribVec4(NORMALIZED_VIEW_VEC, 0.0f, 0.0f, -1.0f, 0.0f, true));
//mVec4Attribs.add(AttribVec4(NORMALIZED_RIGHT_VEC, 1.0f, 0.0f, 0.0f, 0.0f, true));
//mVec4Attribs.add(AttribVec4(UP_VEC, 0.0f, 1.0f, 0.0f, 0.0f));
//mVec4Attribs.add(AttribVec4(NORMALIZED_UP_VEC, 0.0f, 1.0f, 0.0f, 0.0f, true));
//mVec4Attribs.add(AttribVec4(LOOK_AT_POINT, 0.0f, 0.0f, -1.0, 1.0));
m_Id = 0;
m_Name = name;
m_pViewport = CURITIBA->getDefaultViewport();
m_Float4Props[POSITION].set(0.0f, 0.0f, 0.0f, 1.0f);
m_Float4Props[VIEW_VEC].set(0.0f, 0.0f, -1.0f, 0.0f);
m_Float4Props[NORMALIZED_VIEW_VEC].set(0.0f, 0.0f, -1.0f, 0.0f);
m_Float4Props[NORMALIZED_RIGHT_VEC].set(1.0f, 0.0f, 0.0f, 0.0f);
m_Float4Props[UP_VEC].set(0.0f, 1.0f, 0.0f, 0.0f);
m_Float4Props[NORMALIZED_UP_VEC].set(0.0f, 1.0f, 0.0f, 0.0f);
m_Float4Props[LOOK_AT_POINT].set(0.0f, 0.0f, -1.0f, 1.0f);
m_FloatProps[FOV] = 60.0f;
m_FloatProps[TOP] = 1.0f;
m_FloatProps[BOTTOM] = -1.0f;
m_FloatProps[LEFT] = -1.0f;
m_FloatProps[RIGHT] = 1.0f;
m_FloatProps[NEARP] = 1.0f;
m_FloatProps[FARP] = 10000.0f;
buildViewMatrix();
buildViewMatrixInverse();
m_StaticCondition = false;
m_BoundingVolume = new BoundingBox;
m_Transform = new SimpleTransform;
setVectorsFromSpherical();
// Adding a Mesh with the frustum lines
Mesh *renderable = (Mesh *)RESOURCEMANAGER->createRenderable("Mesh", m_Name, "Camera");
renderable->setDrawingPrimitive(curitiba::render::IRenderer::LINES);
std::vector<VertexData::Attr> *vertices = new std::vector<VertexData::Attr>(8);
VertexData &vertexData = renderable->getVertexData();
vertexData.setDataFor (VertexData::getAttribIndex("position"), vertices);
MaterialGroup *aMaterialGroup = new MaterialGroup;
std::vector<unsigned int> *indices = new std::vector<unsigned int>(16);
indices->at (0) = Camera::TOP_LEFT_NEAR; indices->at (1) = Camera::TOP_LEFT_FAR;
indices->at (2) = Camera::TOP_RIGHT_NEAR; indices->at (3) = Camera::TOP_RIGHT_FAR;
indices->at (4) = Camera::BOTTOM_RIGHT_NEAR; indices->at (5) = Camera::BOTTOM_RIGHT_FAR;
indices->at (6) = Camera::BOTTOM_LEFT_NEAR; indices->at (7) = Camera::BOTTOM_LEFT_FAR;
indices->at (8) = Camera::TOP_LEFT_FAR; indices->at (9) = Camera::TOP_RIGHT_FAR;
indices->at (10) = Camera::TOP_RIGHT_FAR; indices->at (11) = Camera::BOTTOM_RIGHT_FAR;
indices->at (12) = Camera::BOTTOM_RIGHT_FAR; indices->at (13) = Camera::BOTTOM_LEFT_FAR;
indices->at (14) = Camera::BOTTOM_LEFT_FAR; indices->at (15) = Camera::TOP_LEFT_FAR;
aMaterialGroup->setIndexList (indices);
aMaterialGroup->setParent (renderable);
aMaterialGroup->setMaterialName("__Emission White");
renderable->addMaterialGroup (aMaterialGroup);
m_Transform = & m_Mat4Props[VIEW_INVERSE_MATRIX];
setRenderable (renderable);
aMaterialGroup = new MaterialGroup;
indices = new std::vector<unsigned int>(8);
indices->at (0) = Camera::TOP_LEFT_NEAR; indices->at (1) = Camera::TOP_RIGHT_NEAR;
indices->at (2) = Camera::TOP_RIGHT_NEAR; indices->at (3) = Camera::BOTTOM_RIGHT_NEAR;
indices->at (4) = Camera::BOTTOM_RIGHT_NEAR; indices->at (5) = Camera::BOTTOM_LEFT_NEAR;
indices->at (6) = Camera::BOTTOM_LEFT_NEAR; indices->at (7) = Camera::TOP_LEFT_NEAR;
aMaterialGroup->setIndexList (indices);
//.........这里部分代码省略.........