public override void SetUp() { base.SetUp(); Compiler = new EpicModelCompiler(Model); CompiledModel = Compiler.Compile(); }
public void SetUp() { _materialCache = new MaterialCache(); _parentMtl = _materialCache.Add("testmtl1"); _childMtl = _materialCache.Add("testmtl2"); _epicModel = new EpicModel(); _parentCuboid = Cuboid.CreateCuboid(); _parentCuboid.Size = new Vector3(2, 2, 2); _parentCuboid.Rotation = new Vector3(0, 0, -(float)Math.PI / 4.0f); _parentCuboid.MaterialId = _parentMtl.Id; _connector = _parentCuboid.AddAnchor("Connector"); _connector.Position = new Vector3(1, 1, 0); _childCuboid = Cuboid.CreateCuboid(); _childCuboid.Position = new Vector3(-1, -1, 0); _childCuboid.Rotation = new Vector3(0, 0, -(float)Math.PI / 2.0f); _childCuboid.MaterialId = _childMtl.Id; _epicModel.ModelParts.Add(_parentCuboid); _childCuboid.Pivot.SetParent(_connector); _compiler = new EpicModelCompiler(_epicModel); _compiledModel = _compiler.Compile(); _modelInstance = new ModelInstance(_compiledModel, _materialCache); _modelInstance.Update(1 / 24.0f); }
private ModelInstance CreateModel(Material material) { var model = new EpicModel(); var parent = Cuboid.CreateCuboid(); parent.Position = new Vector3(0.25f, 0.25f, -0.25f); parent.MaterialId = material.Id; model.ModelParts.Add(parent); parent.Size = new Vector3(2, 2, 2); model.ModelParts.Add(parent); parent.MaterialId = material.Id; for (int i = 0; i < ChildCount; i++) { var child = Cuboid.CreateCuboid(); child.Position = new Vector3(i, i, -i); child.Pivot.SetParent(parent.Pivot, true); child.MaterialId = material.Id; model.ModelParts.Add(child); } var emc = new EpicModelCompiler(model); var compiledModel = emc.Compile(); var modelInstance = new ModelInstance(compiledModel, _materialCache); _vertexCount = modelInstance.MeshInstances[0].VertexBuffer.Length; return(modelInstance); }
public void SaveAndLoad() { Logger.Add(new TraceLogger { LoggerLevel = LoggerLevel.Trace }); _model = new EpicModel(); var cuboid = Cuboid.CreateCuboid(); cuboid.MaterialId = 1; cuboid.Name = "Cuboid1"; cuboid.AddAnchor("a1"); cuboid.AddAnchor("a2"); var cuboid2 = Cuboid.CreateCuboid(); cuboid2.MaterialId = 1; cuboid2.Name = "Cuboid2"; var a3 = cuboid2.AddAnchor("a3"); var a4 = cuboid2.AddAnchor("a4"); a4.Position = new Vector3(0.5f, 0.0f, 0.0f); cuboid.Pivot.SetParent(a3); _model.ModelParts.Add(cuboid); _model.ModelParts.Add(cuboid2); var cuboid3 = Cuboid.CreateCuboid(); cuboid3.MaterialId = 0; _model.ModelParts.Add(cuboid3); var animation = _model.GetAnimation(AnimationType.Drop, true); animation.AddFrame().Time = 0.0f; animation.AddFrame().Time = 0.265f; animation.AddFrame().Time = 0.384f; var animation2 = _model.GetAnimation(AnimationType.Death3, true); animation2.AddFrame().Time = 0.0f; cuboid2.Rotation = new Vector3(0.0f, 0.0f, (float)(Math.PI / 2.0f)); cuboid2.Position = new Vector3(-1f, -1f, 0); var frame2 = animation2.AddFrame(); frame2.LoadFromCurrentModelState(_model); frame2.Time = 0.519f; cuboid2.Rotation = new Vector3(); cuboid2.Position = new Vector3(); _compiler = new EpicModelCompiler(_model); _compiledModel = _compiler.Compile(); }
public override void SetUp() { base.SetUp(); Compiler = new EpicModelCompiler(Model); CompiledModel = Compiler.Compile(); MaterialCache = new MaterialCache(); MaterialCache.Add("example_material"); ModelInstance = new ModelInstance(CompiledModel, MaterialCache); }
public void Compile() { _epicModel = new Psy.Core.EpicModel.EpicModel(); var cuboid = Cuboid.CreateCuboid(); cuboid.Size = new Vector3(1.0f, 1.0f, 1.0f); _epicModel.ModelParts.Add(cuboid); _compiler = new EpicModelCompiler(_epicModel); _compiledModel = _compiler.Compile(); }
public void SetUp() { _materialCache = new MaterialCache(); var testmtl = _materialCache.Add("testmtl"); _epicModel = new Psy.Core.EpicModel.EpicModel(); var cuboid = Cuboid.CreateCuboid(); cuboid.Size = new Vector3(1.0f, 1.0f, 1.0f); cuboid.MaterialId = testmtl.Id; _epicModel.ModelParts.Add(cuboid); _compiler = new EpicModelCompiler(_epicModel); _compiledModel = _compiler.Compile(); _modelInstance = new ModelInstance(_compiledModel, _materialCache); _modelInstance.Update(1 / 24.0f); }