void MD5ModelNode::render(RenderableCollector& collector, const VolumeTest& volume,
		const Matrix4& localToWorld, const IRenderEntity& entity) const
{
	// Do some rough culling (per model, not per surface)
	if (volume.TestAABB(localAABB(), localToWorld) == VOLUME_OUTSIDE)
	{
		return;
	}

	SurfaceLightLists::const_iterator j = _surfaceLightLists.begin();

	// greebo: Iterate over all MD5 surfaces and render them
	for (MD5Model::const_iterator i = _model->begin();
		 i != _model->end();
		 ++i, ++j)
	{
		assert(i->shader);

		// Get the Material to test the shader name against the filter system
		const MaterialPtr& surfaceShader = i->shader->getMaterial();

		if (surfaceShader->isVisible())
		{
			collector.setLights(*j);
			i->surface->render(collector, localToWorld, i->shader, entity);
		}
	}

	// Uncomment to render the skeleton
	//collector.SetState(entity.getWireShader(), RenderableCollector::eFullMaterials);
	//collector.addRenderable(_model->getRenderableSkeleton(), localToWorld, entity);
}
Exemple #2
0
void Node::evaluateBounds() const
{
	if (_boundsChanged)
	{
		ASSERT_MESSAGE(!_boundsMutex, "re-entering bounds evaluation");
		_boundsMutex = true;

		_bounds = childBounds();

		_bounds.includeAABB(
			AABB::createFromOrientedAABBSafe(localAABB(), localToWorld())
		);

		_boundsMutex = false;
		_boundsChanged = false;

		// Now that our bounds are re-calculated, notify the scenegraph
		GraphPtr sceneGraph = _sceneGraph.lock();

		if (sceneGraph)
		{
			sceneGraph->nodeBoundsChanged(const_cast<Node*>(this)->shared_from_this());
		}
	}
}
Exemple #3
0
void Node::evaluateBounds() const
{
	if (_boundsChanged)
	{
		ASSERT_MESSAGE(!_boundsMutex, "re-entering bounds evaluation");
		_boundsMutex = true;

		_bounds = childBounds();

		_bounds.includeAABB(
		    aabb_for_oriented_aabb_safe(localAABB(), localToWorld())
		);

		_boundsMutex = false;
		_boundsChanged = false;

		// Now that our bounds are re-calculated, notify the scenegraph
		GlobalSceneGraph().nodeBoundsChanged(const_cast<Node*>(this)->shared_from_this());
	}
}
Exemple #4
0
void MD5ModelNode::render(RenderableCollector& collector, const VolumeTest& volume,
		const Matrix4& localToWorld) const
{
	// Do some rough culling (per model, not per surface)
	if (volume.TestAABB(localAABB(), localToWorld) == VOLUME_OUTSIDE)
	{
		return;
	}

	SurfaceLightLists::const_iterator j = _surfaceLightLists.begin();
	SurfaceRemaps::const_iterator k = _surfaceRemaps.begin();

	// greebo: Iterate over all MD5 surfaces and render them
	for (MD5Model::const_iterator i = _model->begin(); 
		 i != _model->end(); 
		 ++i, ++j, ++k)
	{
		collector.setLights(*j);
		(*i)->render(collector, localToWorld, k->shader != NULL ? k->shader : (*i)->getState());
	}
}
Exemple #5
0
		VolumeIntersectionValue intersectVolume (const VolumeTest& volume, const Matrix4& localToWorld) const
		{
			return volume.TestAABB(localAABB(), localToWorld);
		}