コード例 #1
0
	void SkeletalAnimatedObject::fillFrameDescription(const CullingVolumesSet& cullingVolumes,
													FrameDescription& scene,
													const SceneMembership membership) const
	{
		/*
		 this method got overcomplicated, so here's a quick summary
		 SkinnedObjectDrawTask takes (as it's final argument) pointer to
		 scene, which is a StackAllocator, so it can allocate a variable-lenght
		 arrays for matrix-pallete and meshes pointers. Later one these arrays
		 are being filled:
		 matrix-palette indirectly, via pose pointer, and
		 meshes-array via setGeometryAt(index, pointer to geometry)
		 
		 Sorry for all complications, I couldn't figure out a cleaner solution
		 for custom allocation.
		 */
		matrix4f transformation = getWorldToLocalR();
		SkinnedObjectDrawTask * task =
			new (scene) SkinnedObjectDrawTask(
											transformation,
											getNumMeshes(),
											skeleton->numJoints,
											&scene);

		const matrix4f * reversePose = skeleton->getReversePose();
		matrix4f * pose = task->getMatrixPalettePtr();
		animationSet.getSkeletonPose(pose);

		for (uint i = 0; i < skeleton->numJoints; i++)
		{
			pose[i] = reversePose[i] * pose[i];
			if (jointSpatials[i])
				jointSpatials[i]->recursiveFillFrameDescription(cullingVolumes, scene);
		}

		for (uint i = 0; i < getNumMeshes(); ++i)
			task->setGeometryAt(i, getMeshAt(i)->getGeometry());

		if (membership == SceneMembership::VisibleObject)
			scene.visibleObjects.push_back(task);
		else
			scene.shadowCasters.push_back(task);
	}
コード例 #2
0
ファイル: Mesh3D.cpp プロジェクト: quocble/LimbicGL
void Mesh3D::draw(SceneGraph *scene, Sprite3D *sprite)
{
	draw(scene, sprite, 0, getNumMeshes());
}
コード例 #3
0
ファイル: scene.cpp プロジェクト: jiayu1016/dizzy
bool Scene::atLeastOneMeshHasNormal() {
    for (size_t i=0; i<getNumMeshes(); i++) {
        if (mMeshes[i]->hasVertexNormals()) return true;
    }
    return false;
}