本文整理汇总了C++中scene::INodePtr::localToWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ INodePtr::localToWorld方法的具体用法?C++ INodePtr::localToWorld怎么用?C++ INodePtr::localToWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene::INodePtr
的用法示例。
在下文中一共展示了INodePtr::localToWorld方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrix4_assign_rotation_for_pivot
void matrix4_assign_rotation_for_pivot(Matrix4& matrix, const scene::INodePtr& node) {
EditablePtr editable = Node_getEditable(node);
// If the instance is editable, take the localpivot point into account, otherwise just apply the rotation
if (editable != 0) {
matrix4_assign_rotation(matrix, node->localToWorld().getMultipliedBy(editable->getLocalPivot()));
}
else {
matrix4_assign_rotation(matrix, node->localToWorld());
}
}
示例2: visit
void ScaleSelected::visit(const scene::INodePtr& node) const {
ITransformNodePtr transformNode = Node_getTransformNode(node);
if(transformNode != 0)
{
ITransformablePtr transform = Node_getTransformable(node);
if(transform != 0)
{
transform->setType(TRANSFORM_PRIMITIVE);
transform->setScale(c_scale_identity);
transform->setTranslation(c_translation_identity);
transform->setType(TRANSFORM_PRIMITIVE);
transform->setScale(m_scale);
{
EditablePtr editable = Node_getEditable(node);
const Matrix4& localPivot = editable != 0 ? editable->getLocalPivot() : Matrix4::getIdentity();
Vector3 parent_translation;
translation_for_pivoted_scale(
parent_translation,
m_scale,
m_world_pivot,
node->localToWorld().getMultipliedBy(localPivot),
transformNode->localToParent().getMultipliedBy(localPivot)
);
transform->setTranslation(parent_translation);
}
}
}
}
示例3: processLight
void ModelExporter::processLight(const scene::INodePtr& node)
{
// Export lights as small polyhedron
static const double EXTENTS = 8.0;
std::vector<model::ModelPolygon> polys;
Vertex3f up(0, 0, EXTENTS);
Vertex3f down(0, 0, -EXTENTS);
Vertex3f north(0, EXTENTS, 0);
Vertex3f south(0, -EXTENTS, 0);
Vertex3f east(EXTENTS, 0, 0);
Vertex3f west(-EXTENTS, 0, 0);
// Upper semi-diamond
polys.push_back(createPolyCCW(up, south, east));
polys.push_back(createPolyCCW(up, east, north));
polys.push_back(createPolyCCW(up, north, west));
polys.push_back(createPolyCCW(up, west, south));
// Lower semi-diamond
polys.push_back(createPolyCCW(down, south, west));
polys.push_back(createPolyCCW(down, west, north));
polys.push_back(createPolyCCW(down, north, east));
polys.push_back(createPolyCCW(down, east, south));
Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);
_exporter->addPolygons("lights/default", polys, exportTransform);
}
示例4: processBrush
void ModelExporter::processBrush(const scene::INodePtr& node)
{
IBrush* brush = Node_getIBrush(node);
if (brush == nullptr) return;
Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);
for (std::size_t b = 0; b < brush->getNumFaces(); ++b)
{
const IFace& face = brush->getFace(b);
const std::string& materialName = face.getShader();
if (!isExportableMaterial(materialName)) continue;
const IWinding& winding = face.getWinding();
std::vector<model::ModelPolygon> polys;
if (winding.size() < 3)
{
rWarning() << "Skipping face with less than 3 winding verts" << std::endl;
continue;
}
// Create triangles for this winding
for (std::size_t i = 1; i < winding.size() - 1; ++i)
{
model::ModelPolygon poly;
poly.a = convertWindingVertex(winding[i + 1]);
poly.b = convertWindingVertex(winding[i]);
poly.c = convertWindingVertex(winding[0]);
polys.push_back(poly);
}
_exporter->addPolygons(materialName, polys, exportTransform);
}
}
示例5: processPatch
void ModelExporter::processPatch(const scene::INodePtr& node)
{
IPatch* patch = Node_getIPatch(node);
if (patch == nullptr) return;
const std::string& materialName = patch->getShader();
if (!isExportableMaterial(materialName)) return;
PatchMesh mesh = patch->getTesselatedPatchMesh();
std::vector<model::ModelPolygon> polys;
for (std::size_t h = 0; h < mesh.height - 1; ++h)
{
for (std::size_t w = 0; w < mesh.width - 1; ++w)
{
model::ModelPolygon poly;
poly.a = convertPatchVertex(mesh.vertices[w + (h*mesh.width)]);
poly.b = convertPatchVertex(mesh.vertices[w + 1 + (h*mesh.width)]);
poly.c = convertPatchVertex(mesh.vertices[w + mesh.width + (h*mesh.width)]);
polys.push_back(poly);
poly.a = convertPatchVertex(mesh.vertices[w + 1 + (h*mesh.width)]);
poly.b = convertPatchVertex(mesh.vertices[w + 1 + mesh.width + (h*mesh.width)]);
poly.c = convertPatchVertex(mesh.vertices[w + mesh.width + (h*mesh.width)]);
polys.push_back(poly);
}
}
Matrix4 exportTransform = node->localToWorld().getPremultipliedBy(_centerTransform);
_exporter->addPolygons(materialName, polys, exportTransform);
}