public void LoadScene(byte[] filedata) { MemoryStream sphere = new MemoryStream(filedata); var assimp_scene = BuildAssimpScene(sphere, "dae"); _cur_scene = new SceneWrapper(assimp_scene); _cur_scene.NameUnnamedMeshes(); _cur_scene.NodeNamesAreUnique(); // load other data _action_one = new NodeInterpolator(_cur_scene, _cur_scene._inner.Animations[0]); BoneNode armature = _cur_scene.BuildBoneNodes("Armature"); string mesh_default_name = "Cube"; Node mesh = _cur_scene.FindNode(mesh_default_name); if (mesh == null) { throw new Exception("Could not find node named " + mesh_default_name); } ActionState state = new ActionState(_cur_scene._inner.Animations[0]); _enttity_one = new Entity(_cur_scene, mesh, armature, state); state._owner = _enttity_one; _action_one.ApplyAnimation(_enttity_one._armature, _enttity_one._action); HasScene = true; }
// the only public constructor // TODO: change the "Node mesh". This should point to MeshDraw object which is unique to each entity. public Entity(SceneWrapper sc, Node mesh, BoneNode armature, ActionState state) { _scene = sc; _node = mesh; _extra_geometry = new Geometry(sc._inner.Meshes, mesh, armature); _armature = armature; _action = state; _transform = new TransformState(Matrix4.Identity, 10, 17); }
public NodeInterpolator(SceneWrapper sc, Animation action) { _scene = sc; _action = action; }