예제 #1
0
        public override void Init()
        {
            _world = new World(RC);

            // load mesh as geometry
            var geo1 = MeshReader.ReadWavefrontObj(new StreamReader(@"Assets/Cube.obj.model"));

            // create and set shader
            var sp = RC.CreateShader(VsSimpleTexture, PsSimpleTexture);
            RC.SetShader(sp);

            var material = new ShaderMaterial(sp);

            // load a texture and write a text on it
            var imgData = RC.LoadImage("Assets/cube_tex.jpg");
            imgData = RC.TextOnImage(imgData, "Verdana", 80f, "FUSEE rocks!", "Black", 0, 30);

            var iTex = RC.CreateTexture(imgData);

            Texture1Param = sp.GetShaderParam("texture1");
            RC.SetShaderParamTexture(Texture1Param, iTex);

            // add object with material
            _world.AddObject(geo1, material, 0, 0, 500);

            RC.ClearColor = new float4(0.1f, 0.1f, 0.1f, 1);
        }
예제 #2
0
 public Object(Geometry geo, ShaderMaterial m, int x, int y, int z)
 {
     _mesh = geo.ToMesh();
     _material = m;
     _posX = x;
     _posY = y;
     _posZ = z;
     _angX = .0f;
     _angY = .0f;
     _angY = .0f;
 }
예제 #3
0
 public void AddObject(Geometry geo, ShaderMaterial m, int posX, int posY, int posZ)
 {
     _objects.Add(new Object(geo, m, posX, posY, posZ));
 }