コード例 #1
0
        public override void Init()
        {
            RC.ClearColor = new float4(1, 1, 1, 1);
            _spColor = MoreShaders.GetDiffuseColorShader(RC);
            _colorParam = _spColor.GetShaderParam("color");
            RC.SetShader(_spColor);
            RC.SetShaderParam(_colorParam, new float4(1, 0, 0, 1));
            _watch = new Stopwatch();
            _ser = new FuseeSerializer();
            Debug.WriteLine("Serialisation Example started. \nPress F1 to load Mesh using MeshReader. \nPress F2 to load Mesh using Protobuf.");

            // Example of how to save a Mesh with protobuf to file.
            /*Mesh temp = MeshReader.LoadMesh(@"Assets/Teapot.obj.model");
            using (var file = File.Create(@"Assets/Teapot2.protobuf.model"))
            {
                _ser.Serialize(file,temp);
            }*/
        }
コード例 #2
0
        public override void Init()
        {
            RC.ClearColor = new float4(1, 1, 1, 1);
            _spColor      = Shaders.GetDiffuseColorShader(RC);
            _colorParam   = _spColor.GetShaderParam("color");
            RC.SetShader(_spColor);
            RC.SetShaderParam(_colorParam, new float4(1, 0, 0, 1));
            _watch = new Stopwatch();
            _ser   = new FuseeSerializer();
            Debug.WriteLine(
                "Serialisation Example started. \nPress F1 to load Mesh using MeshReader. \nPress F2 to load Mesh using Protobuf.");

            // Example of how to save a Mesh with protobuf to file.

            /*Mesh temp = MeshReader.LoadMesh(@"Assets/Teapot.obj.model");
             * using (var file = File.Create(@"Assets/Teapot2.protobuf.model"))
             * {
             *  _ser.Serialize(file,temp);
             * }*/
        }
コード例 #3
0
        public GameEntity(String meshPath, RenderContext rc, float posX = 0, float posY = 0, float posZ = 0, float angX = 0, float angY = 0, float angZ = 0)
        {
            if (meshPath.Contains("protobuf"))
            {
                _ser = new FuseeSerializer();
                using (var file = File.OpenRead(meshPath))
                {
                    _mesh = _ser.Deserialize(file, null, typeof(Mesh)) as Mesh;
                }
            }
            else
            {
                _mesh = MeshReader.LoadMesh(meshPath);
            }

            _rc = rc;

            Position = float4x4.CreateRotationX(angX) *
                        float4x4.CreateRotationY(angY) *
                        float4x4.CreateRotationZ(angZ) *
                        float4x4.CreateTranslation(posX, posY, posZ);

            SetShader(_color);
        }
コード例 #4
0
ファイル: GameEntity.cs プロジェクト: reliefpfeiler42/Fusee
        public GameEntity(String meshPath, RenderContext rc, float posX = 0, float posY = 0, float posZ = 0, float angX = 0, float angY = 0, float angZ = 0)
        {
            if (meshPath.Contains("protobuf"))
            {
                _ser = new FuseeSerializer();
                using (var file = File.OpenRead(meshPath))
                {
                    _mesh = _ser.Deserialize(file, null, typeof(Mesh)) as Mesh;
                }
            }
            else
            {
                _mesh = MeshReader.LoadMesh(meshPath);
            }

            _rc = rc;

            Position = float4x4.CreateRotationX(angX) *
                       float4x4.CreateRotationY(angY) *
                       float4x4.CreateRotationZ(angZ) *
                       float4x4.CreateTranslation(posX, posY, posZ);

            SetShader(_color);
        }