本文整理汇总了C++中SubModel::getTreeNode方法的典型用法代码示例。如果您正苦于以下问题:C++ SubModel::getTreeNode方法的具体用法?C++ SubModel::getTreeNode怎么用?C++ SubModel::getTreeNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubModel
的用法示例。
在下文中一共展示了SubModel::getTreeNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillVertexAndIndexArrays
void ModelContainerView::fillVertexAndIndexArrays(const SubModel& pSm, Array<Vector3>& vArray, Array<int>& iArray) {
Array<TriangleBox> tbarray;
fillRenderArray(pSm, tbarray, &pSm.getTreeNode(0));
MeshBuilder builder;
int len = tbarray.size();
int count = 0;
for(int i=0;i<len;++i) {
Triangle t = Triangle(tbarray[i].vertex(0).getVector3() + pSm.getBasePosition(),
tbarray[i].vertex(1).getVector3() + pSm.getBasePosition(),
tbarray[i].vertex(2).getVector3() + pSm.getBasePosition());
vArray.append(t.vertex(0));
vArray.append(t.vertex(1));
vArray.append(t.vertex(2));
iArray.append(count+0);
iArray.append(count+1);
iArray.append(count+1);
iArray.append(count+2);
iArray.append(count+2);
iArray.append(count+0);
count+=3;
}
}
示例2: fillContainer
void ModelContainer::fillContainer(const AABSPTree<SubModel *>::Node& pNode, int &pSubModelPos, int &pTreeNodePos, int &pTrianglePos, Vector3& pLo, Vector3& pHi, Vector3& pFinalLo, Vector3& pFinalHi)
{
// TreeNode for the SubModel
TreeNode treeNode = TreeNode(pNode.valueArray.size(), pSubModelPos);
treeNode.setSplitAxis(pNode.splitAxis);
treeNode.setSplitLocation(pNode.splitLocation);
int currentTreeNodePos = pTreeNodePos++;
Vector3 lo = Vector3(inf(),inf(),inf());
Vector3 hi = Vector3(-inf(),-inf(),-inf());
for (int i=0; i<pNode.valueArray.size(); i++)
{
G3D::_AABSPTree::Handle<SubModel*>* h= pNode.valueArray[i];
SubModel *m = h->value;
memcpy(&getTreeNodes()[pTreeNodePos], &m->getTreeNode(0), sizeof(TreeNode) * m->getNNodes());
memcpy(&getTriangles()[pTrianglePos], &m->getTriangle(0), sizeof(TriangleBox) * m->getNTriangles());
SubModel newModel = SubModel(m->getNTriangles(), getTriangles(), pTrianglePos, m->getNNodes(), getTreeNodes(), pTreeNodePos);
newModel.setReletiveBounds(m->getReletiveBounds().getLo(), m->getReletiveBounds().getHi());
newModel.setBasePosition(m->getBasePosition());
iSubModel[pSubModelPos++] = newModel;
pTreeNodePos += m->getNNodes();
pTrianglePos += m->getNTriangles();
AABox box = m->getAABoxBounds();
lo = lo.min(box.low());
hi = hi.max(box.high());
pFinalLo = pFinalLo.min(lo);
pFinalHi = pFinalHi.max(hi);
}
/*
if(pNode.valueArray.size() == 0) {
int xxx = 0; // just for the breakpoint
}
*/
// get absolute bounds
if(pNode.child[0] != 0)
{
treeNode.setChildPos(0, pTreeNodePos);
fillContainer(*pNode.child[0], pSubModelPos, pTreeNodePos, pTrianglePos, lo, hi,pFinalLo,pFinalHi);
}
if(pNode.child[1] != 0)
{
treeNode.setChildPos(1, pTreeNodePos);
fillContainer(*pNode.child[1], pSubModelPos, pTreeNodePos, pTrianglePos, lo, hi,pFinalLo,pFinalHi);
}
pLo = pLo.min(lo);
pHi = pHi.max(hi);
treeNode.setBounds(lo,hi);
setTreeNode(treeNode, currentTreeNodePos);
}
示例3: fillRenderArray
void
ModelContainerView::fillVertexArray (const SubModel& pSm, Array<Vector3>& vArray)
{
//printf("fillVertexArray for %i-%i\n",VMAP::hashCode(SubModel),5);
//printf("fillVertexArray for %i\n",VMAP::hashCode(pSm));
Array<TriangleBox> tbarray;
fillRenderArray (pSm, tbarray, &pSm.getTreeNode (0));
int len = tbarray.size ();
Vector3 toconvert[3];
for (int i = 0; i < len; ++i)
{
// TODO: Get correct Conversion of position values.
// The system between vmaps and MaNGOS differs in that:
/* from iinternal(xyz) -> MaNGOS(xyz)
float pos[3];
pos[0] = z;
pos[1] = x;
pos[2] = y;
double full = 64.0*533.33333333;
double mid = full/2.0;
pos[0] = -((mid+pos[0])-full); -> -mid -pos[0] + full -> mid - z
pos[1] = -((mid+pos[1])-full); -> -mid -pos[0] + full -> mid - x
*/
TriangleBox old = tbarray[i];
toconvert[0] = old.vertex(0).getVector3 () + pSm.getBasePosition ();
toconvert[1] = old.vertex(1).getVector3 () + pSm.getBasePosition ();
toconvert[2] = old.vertex(2).getVector3 () + pSm.getBasePosition ();
for (int j = 0; j < 3; j++) {
toconvert[j] = toconvert[j].zxy();
toconvert[j].x = MID - toconvert[j].x;
toconvert[j].y = MID - toconvert[j].y;
}
//TODO: playing around with correct range of triangles for detour
Triangle t = Triangle(toconvert[0],toconvert[1],toconvert[2]);
Triangle t1 = Triangle(toconvert[2],toconvert[1],toconvert[0]);
globalTriangleArray.append(t,t1);
/*
for (int j = 2; j>= 0; j--) {
Vector3 vertex = tbarray[i].vertex(j).getVector3() + pSm.getBasePosition();
// x = [expr {-(($::mid+$x)-$::full)}]
//printf("x[%.2f] y[%.2f] z[%.2f]",vertex.x,vertex.y,vertex.z);
// v 152.333 60.0304 -9561.67
vertex = Vector3(-((64*533.333333333/2 + vertex.z) - 64*533.333333333),
-((64*533.333333333/2 + vertex.x) - 64*533.333333333),
vertex.y);
vArray.append(vertex);
}
*/
}
}