本文整理汇总了C++中SCENENODE::GetNode方法的典型用法代码示例。如果您正苦于以下问题:C++ SCENENODE::GetNode方法的具体用法?C++ SCENENODE::GetNode怎么用?C++ SCENENODE::GetNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCENENODE
的用法示例。
在下文中一共展示了SCENENODE::GetNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDrawableFromNode
bool SPRITE2D::Load(
SCENENODE & parent,
const std::string & texturepath,
const std::string & texturename,
ContentManager & content,
float draworder)
{
Unload(parent);
assert(!draw.valid());
assert(!node.valid());
TEXTUREINFO texinfo;
texinfo.mipmap = false;
texinfo.repeatu = false;
texinfo.repeatv = false;
texinfo.npot = false;
std::tr1::shared_ptr<TEXTURE> texture;
if (!content.load(texturepath, texturename, texinfo, texture)) return false;
node = parent.AddNode();
SCENENODE & noderef = parent.GetNode(node);
draw = noderef.GetDrawlist().twodim.insert(DRAWABLE());
DRAWABLE & drawref = GetDrawableFromNode(noderef);
drawref.SetDiffuseMap(texture);
drawref.SetVertArray(&varray);
drawref.SetDrawOrder(draworder);
drawref.SetCull(false, false);
drawref.SetColor(r,g,b,a);
//std::cout << "Sprite draworder: " << draworder << std::endl;
return true;
}
示例2: LoadWheel
static bool LoadWheel(
const PTree & cfg_wheel,
struct LoadDrawable & loadDrawable,
SCENENODE & topnode,
std::ostream & error_output)
{
keyed_container<SCENENODE>::handle wheelnode = topnode.AddNode();
ContentManager & content = loadDrawable.content;
const std::string& path = loadDrawable.path;
std::string meshname;
std::vector<std::string> texname;
if (!cfg_wheel.get("mesh", meshname, error_output)) return false;
if (!cfg_wheel.get("texture", texname, error_output)) return false;
std::string tiredim;
const PTree * cfg_tire;
if (!cfg_wheel.get("tire", cfg_tire, error_output)) return false;
if (!cfg_tire->get("size", tiredim, error_output)) return false;
MATHVECTOR<float, 3> size(0);
cfg_tire->get("size", size);
float width = size[0] * 0.001;
float diameter = size[2] * 0.0254;
// get wheel disk mesh
std::tr1::shared_ptr<MODEL> mesh;
if (!content.load(path, meshname, mesh)) return false;
// gen wheel mesh
if (!content.get(path, meshname+tiredim, mesh))
{
VERTEXARRAY rimva, diskva;
MESHGEN::mg_rim(rimva, size[0], size[1], size[2], 10);
diskva = mesh->GetVertexArray();
diskva.Translate(-0.75 * 0.5, 0, 0);
diskva.Scale(width, diameter, diameter);
content.load(path, meshname+tiredim, rimva + diskva, mesh);
}
// load wheel
if (!loadDrawable(meshname+tiredim, texname, cfg_wheel, topnode, &wheelnode))
{
return false;
}
// tire (optional)
texname.clear();
if (!cfg_tire->get("texture", texname, error_output)) return true;
// gen tire mesh
if (!content.get(path, "tire"+tiredim, mesh))
{
VERTEXARRAY tireva;
MESHGEN::mg_tire(tireva, size[0], size[1], size[2]);
content.load(path, "tire"+tiredim, tireva, mesh);
}
// load tire
if (!loadDrawable("tire"+tiredim, texname, *cfg_tire, topnode.GetNode(wheelnode)))
{
return false;
}
// brake (optional)
texname.clear();
std::string brakename;
const PTree * cfg_brake;
if (!cfg_wheel.get("brake", cfg_brake, error_output)) return true;
if (!cfg_brake->get("texture", texname)) return true;
float radius;
std::string radiusstr;
cfg_brake->get("radius", radius);
cfg_brake->get("radius", radiusstr);
// gen brake disk mesh
if (!content.get(path, "brake"+radiusstr, mesh))
{
float diameter_mm = radius * 2 * 1000;
float thickness_mm = 0.025 * 1000;
VERTEXARRAY brakeva;
MESHGEN::mg_brake_rotor(brakeva, diameter_mm, thickness_mm);
content.load(path, "brake"+radiusstr, brakeva, mesh);
}
// load brake disk
if (!loadDrawable("brake"+radiusstr, texname, *cfg_brake, topnode.GetNode(wheelnode)))
{
return false;
}
return true;
}