Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public void SetUp()
        {
            _materialCache = new MaterialCache();
            var material = _materialCache.Add("mat");

            _instances = new List <ModelInstance>();

            for (int i = 0; i < InstanceCount; i++)
            {
                _instances.Add(CreateModel(material));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Adds a Material based of the ShaderEffect sfx with the specified identifier id
        /// </summary>
        /// <param name="id">the id assigned</param>
        /// <param name="sfx">the shader used</param>
        /// <returns>The created Material</returns>
        public Material AddMaterial(string id, ShaderEffectData sfx)
        {
            string   fullId = GetFID(id, sfx);
            Material mat;

            if (!MaterialCache.ContainsKey(fullId))
            {
                mat = new Material(sfx.Material);
                MaterialCache.Add(fullId, mat);
            }
            else
            {
                return(GetMaterial(id, sfx));
            }
            CameraManager?.AddMaterial(mat);
            return(mat);
        }
Beispiel #5
0
        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);
        }