本文整理汇总了C++中LODNode::add方法的典型用法代码示例。如果您正苦于以下问题:C++ LODNode::add方法的具体用法?C++ LODNode::add怎么用?C++ LODNode::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LODNode
的用法示例。
在下文中一共展示了LODNode::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: debug_name
Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
scene::IMesh* mesh, scene::IMesh* lowres_mesh)
{
assert(type != ITEM_TRIGGER); // use other constructor for that
m_distance_2 = 1.2f;
initItem(type, xyz);
m_original_rotation = shortestArcQuat(Vec3(0, 1, 0), normal);
m_rotation_angle = 0.0f;
m_original_mesh = mesh;
m_original_lowmesh = lowres_mesh;
m_listener = NULL;
LODNode* lodnode = new LODNode("item",
irr_driver->getSceneManager()->getRootSceneNode(),
irr_driver->getSceneManager());
scene::IMeshSceneNode* meshnode =
irr_driver->addMesh(mesh, StringUtils::insertValues("item_%i", (int)type));
if (lowres_mesh != NULL)
{
lodnode->add(35, meshnode, true);
scene::IMeshSceneNode* meshnode =
irr_driver->addMesh(lowres_mesh,
StringUtils::insertValues("item_lo_%i", (int)type));
lodnode->add(100, meshnode, true);
}
else
{
lodnode->add(100, meshnode, true);
}
m_node = lodnode;
//m_node = irr_driver->addMesh(mesh);
#ifdef DEBUG
std::string debug_name("item: ");
debug_name += m_type;
m_node->setName(debug_name.c_str());
#endif
World::getWorld()->getTrack()->adjustForFog(m_node);
m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
m_node->setPosition(xyz.toIrrVector());
Vec3 hpr;
hpr.setHPR(m_original_rotation);
m_node->setRotation(hpr.toIrrHPR());
m_node->grab();
} // Item(type, xyz, normal, mesh, lowres_mesh)
示例2: runtime_error
// ----------------------------------------------------------------------------
TrackObjectPresentationParticles::TrackObjectPresentationParticles(
const XMLNode& xml_node,
scene::ISceneNode* parent)
: TrackObjectPresentationSceneNode(xml_node)
{
m_emitter = NULL;
m_lod_emitter_node = NULL;
std::string path;
xml_node.get("kind", &path);
int clip_distance = -1;
xml_node.get("clip_distance", &clip_distance);
xml_node.get("conditions", &m_trigger_condition);
bool auto_emit = true;
xml_node.get("auto_emit", &auto_emit);
m_delayed_stop = false;
m_delayed_stop_time = 0.0;
#ifndef SERVER_ONLY
try
{
ParticleKind* kind = ParticleKindManager::get()->getParticles(path);
if (kind == NULL)
{
throw std::runtime_error(path + " could not be loaded");
}
ParticleEmitter* emitter = new ParticleEmitter(kind, m_init_xyz, parent);
if (clip_distance > 0)
{
scene::ISceneManager* sm = irr_driver->getSceneManager();
scene::ISceneNode* sroot = sm->getRootSceneNode();
LODNode* lod = new LODNode("particles", !parent ? sroot : parent, sm);
lod->add(clip_distance, (scene::ISceneNode*)emitter->getNode(), true);
m_node = lod;
m_lod_emitter_node = lod;
m_emitter = emitter;
}
else
{
m_node = emitter->getNode();
m_emitter = emitter;
}
if (m_trigger_condition.size() > 0 || !auto_emit)
{
m_emitter->setCreationRateAbsolute(0.0f);
}
}
catch (std::runtime_error& e)
{
Log::warn ("Track", "Could not load particles '%s'; cause :\n %s",
path.c_str(), e.what());
}
#endif
} // TrackObjectPresentationParticles
示例3: LODNode
/** Constructor for an item.
* \param type Type of the item.
* \param xyz Location of the item.
* \param normal The normal upon which the item is placed (so that it can
* be aligned properly with the ground).
* \param mesh The mesh to be used for this item.
* \param owner 'Owner' of this item, i.e. the kart that drops it. This is
* used to deactivate this item for the owner, i.e. avoid that a kart
* 'collects' its own bubble gum. NULL means no owner, and the item
* can be collected immediatley by any kart.
*/
Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
scene::IMesh* mesh, scene::IMesh* lowres_mesh,
const AbstractKart *owner)
: ItemState(type, owner)
{
m_was_available_previously = true;
m_distance_2 = 1.2f;
initItem(type, xyz, normal);
m_graphical_type = getGrahpicalType();
LODNode* lodnode =
new LODNode("item", irr_driver->getSceneManager()->getRootSceneNode(),
irr_driver->getSceneManager());
scene::ISceneNode* meshnode =
irr_driver->addMesh(mesh, StringUtils::insertValues("item_%i", (int)type));
if (lowres_mesh != NULL)
{
lodnode->add(35, meshnode, true);
scene::ISceneNode* meshnode =
irr_driver->addMesh(lowres_mesh,
StringUtils::insertValues("item_lo_%i", (int)type));
lodnode->add(100, meshnode, true);
}
else
{
lodnode->add(100, meshnode, true);
}
m_node = lodnode;
setType(type);
handleNewMesh(getGrahpicalType());
#ifdef DEBUG
std::string debug_name("item: ");
debug_name += getType();
m_node->setName(debug_name.c_str());
#endif
m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
m_node->setPosition(xyz.toIrrVector());
Vec3 hpr;
hpr.setHPR(getOriginalRotation());
m_node->setRotation(hpr.toIrrHPR());
m_node->grab();
} // Item(type, xyz, normal, mesh, lowres_mesh)
示例4: runtime_error
TrackObjectPresentationParticles::TrackObjectPresentationParticles(const XMLNode& xml_node, scene::ISceneNode* parent) :
TrackObjectPresentationSceneNode(xml_node)
{
m_emitter = NULL;
m_lod_emitter_node = NULL;
std::string path;
xml_node.get("kind", &path);
int clip_distance = -1;
xml_node.get("clip_distance", &clip_distance);
xml_node.get("conditions", &m_trigger_condition);
try
{
ParticleKind* kind = ParticleKindManager::get()->getParticles( path.c_str() );
if (kind == NULL)
{
throw std::runtime_error(path + " could not be loaded");
}
ParticleEmitter* emitter = new ParticleEmitter(kind, m_init_xyz, parent);
if (clip_distance > 0)
{
scene::ISceneManager* sm = irr_driver->getSceneManager();
scene::ISceneNode* sroot = sm->getRootSceneNode();
LODNode* lod = new LODNode("particles", parent == NULL ? sroot : parent, sm);
lod->add(clip_distance, (scene::ISceneNode*)emitter->getNode(), true);
m_node = lod;
m_lod_emitter_node = lod;
m_emitter = emitter;
}
else
{
m_node = emitter->getNode();
m_emitter = emitter;
}
if (m_trigger_condition.size() > 0)
{
m_emitter->setCreationRateAbsolute(0.0f);
}
}
catch (std::runtime_error& e)
{
fprintf(stderr, "[Track] WARNING: Could not load particles '%s'; cause :\n %s", path.c_str(), e.what());
}
}