本文整理汇总了C++中Part::drawable方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::drawable方法的具体用法?C++ Part::drawable怎么用?C++ Part::drawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part::drawable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(ModelBasicListTest, MergePartsWithTransformation)
{
Vec3fArray* verts = new Vec3fArray;
verts->reserve(3);
verts->add(Vec3f(0, 0, 0));
verts->add(Vec3f(1, 0, 0));
verts->add(Vec3f(1, 1, 0));
Vec3fArray* norms = new Vec3fArray;
norms->resize(3);
norms->set(0, Vec3f::Z_AXIS);
norms->set(1, Vec3f::Z_AXIS);
norms->set(2, Vec3f::Z_AXIS);
DrawableGeo* myGeo = new DrawableGeo;
myGeo->setFromTriangleVertexArray(verts);
myGeo->setNormalArray(norms);
Part* myPart = new Part;
myPart->setDrawable(myGeo);
Part* myPart2 = new Part;
myPart2->setDrawable(myGeo);
ref<ModelBasicList> myModel = new ModelBasicList;
myModel->addPart(myPart);
myModel->addPart(myPart2);
EXPECT_EQ(2, myModel->partCount());
Mat4d matrix;
matrix.setTranslation(Vec3d(10, 20, 30));
Transform* transform = new Transform;
transform->setLocalTransform(matrix);
myPart2->setTransform(transform);
myModel->mergeParts(1000, 1000);
EXPECT_EQ(1, myModel->partCount());
Part* mergedPart = myModel->part(0);
DrawableGeo* mergedGeo = dynamic_cast<DrawableGeo*>(mergedPart->drawable());
const Vec3fArray* vertices = mergedGeo->vertexArray();
EXPECT_EQ(6, vertices->size());
Vec3f v5 = vertices->get(5);
EXPECT_EQ(11, v5.x());
EXPECT_EQ(21, v5.y());
EXPECT_EQ(30, v5.z());
}
示例2: primitiveCount
//--------------------------------------------------------------------------------------------------
/// Count primitives of part in this node - do not recurse
//--------------------------------------------------------------------------------------------------
size_t ModelBasicTreeNode::primitiveCount()
{
size_t totalPrimitiveCount = 0;
size_t j;
for (j = 0; j < m_partList->partCount(); j++)
{
Part* part = m_partList->part(j);
DrawableGeo* drawable = dynamic_cast<DrawableGeo*>(part->drawable());
if (drawable)
{
totalPrimitiveCount += drawable->faceCount();
}
}
return totalPrimitiveCount;
}
示例3: showModelStatistics
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QSRSnippetWidget::showModelStatistics()
{
RenderSequence* renderSeq = m_snippet->renderSequence();
CVF_ASSERT(renderSeq);
size_t totPartCount = 0;
size_t totFaceCount = 0;
int numRenderings = renderSeq->renderingCount();
int ir;
for (ir = 0; ir < numRenderings; ir++)
{
Rendering* rendering = renderSeq->rendering(ir);
CVF_ASSERT(rendering);
Scene* scene = rendering->scene();
CVF_ASSERT(scene);
int numModels = scene->modelCount();
int im;
for (im = 0; im < numModels; im++)
{
Model* model = scene->model(im);
Collection<Part> allParts;
model->allParts(&allParts);
size_t numParts = allParts.size();
size_t ip;
for (ip = 0; ip < numParts; ip++)
{
Part* part = allParts[ip].p();
Drawable* drawable = part->drawable();
totPartCount++;
totFaceCount += drawable->faceCount();
}
}
}
cvf::Trace::show("Total number of parts: %ld", totPartCount);
cvf::Trace::show("Total number of faces: %ld", totFaceCount);
}
示例4: setRenderMode
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void QSRSnippetWidget::setRenderMode(DrawableGeo::RenderMode mode)
{
m_lastSetRenderMode = mode;
Collection<Part> allParts;
RenderSequence* renderSeq = m_snippet->renderSequence();
CVF_ASSERT(renderSeq);
int numPasses = renderSeq->renderingCount();
int i;
for (i = 0; i < numPasses; i++)
{
Rendering* rendering = renderSeq->rendering(i);
CVF_ASSERT(rendering);
Scene* scene = rendering->scene();
CVF_ASSERT(scene);
scene->allParts(&allParts);
}
size_t numParts = allParts.size();
size_t partIdx;
for (partIdx = 0; partIdx < numParts; partIdx++)
{
Part* part = allParts.at(partIdx);
cvf::uint lod;
for (lod = 0; lod < cvf::Part::MAX_NUM_LOD_LEVELS; lod++)
{
DrawableGeo* drawableGeo = dynamic_cast<DrawableGeo*>(part->drawable(lod));
if (drawableGeo)
{
drawableGeo->setRenderMode(m_lastSetRenderMode);
}
}
}
}