Esempio n. 1
0
        private void InitializeMeshes()
        {
            TgcTexture tiles, lava, stones, water;

            tiles  = TgcTexture.createTexture(MediaDir + "Textures/tiles.jpg");
            lava   = TgcTexture.createTexture(MediaDir + "Textures/lava.jpg");
            stones = TgcTexture.createTexture(MediaDir + "Textures/stones.bmp");
            water  = TgcTexture.createTexture(MediaDir + "Textures/water.bmp");

            TGCSphere baseSphere = new TGCSphere(1f, Color.White, TGCVector3.Empty);

            baseSphere.setTexture(lava);
            baseSphere.updateValues();
            sphereOne = baseSphere.toMesh("sphereOne");
            meshes.Add(sphereOne);
            baseSphere.setTexture(stones);
            sphereTwo = baseSphere.toMesh("sphereTwo");
            meshes.Add(sphereTwo);
            baseSphere.setTexture(water);
            sphereThree = baseSphere.toMesh("sphereThree");
            meshes.Add(sphereThree);

            TgcSceneLoader loader = new TgcSceneLoader();
            var            scene  = loader.loadSceneFromFile(MediaDir + "Robot2-TgcScene.xml");

            robot           = scene.Meshes[0];
            robot.Transform = TGCMatrix.Scaling(0.1f, 0.1f, 0.1f) * TGCMatrix.RotationY(FastMath.PI) * TGCMatrix.Translation(TGCVector3.Up * 40f);
            meshes.Add(robot);

            TgcPlane tgcPlane = new TgcPlane(TGCVector3.Empty, TGCVector3.One * 100f, TgcPlane.Orientations.XZplane, tiles, 10f, 10f);

            plane = tgcPlane.toMesh("plane");
            meshes.Add(plane);
        }
Esempio n. 2
0
        public override TgcMesh createMeshToExport()
        {
            var m = mesh.toMesh(Name);

            m.UserProperties      = UserProperties;
            m.Layer               = Layer;
            m.AutoTransformEnable = true;
            return(m);
        }
Esempio n. 3
0
        private void createSphereMesh(TgcTexture texture)
        {
            var rawSphere = new TGCSphere(1, texture, this.center);

            rawSphere.LevelOfDetail = 4;
            rawSphere.updateValues();
            this.sphere = rawSphere.toMesh("Mesh");

            this.sphere.Effect    = this.effect;
            this.sphere.Technique = this.techniques[this.technique];
        }
        private void CreateMesh()
        {
            var lava   = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "\\Texturas\\lava.jpg");
            var sphere = new TGCSphere(1, lava, TGCVector3.Empty);

            sphere.LevelOfDetail = 4;
            sphere.updateValues();

            this.mesh = sphere.toMesh("Mesh");

            this.mesh.Effect = this.effect;
        }
Esempio n. 5
0
        private void InitializeSphere()
        {
            // Got to set a texture, else the translation to mesh does not map UV
            var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Texturas\\white.bmp");

            var sphere = new TGCSphere();

            sphere.Radius        = 40.0f;
            sphere.LevelOfDetail = 3;
            sphere.setTexture(texture);
            sphere.updateValues();

            sphereMesh             = sphere.toMesh("sphere");
            sphereMesh.Transform   = TGCMatrix.Scaling(TGCVector3.One * 30f);
            sphereMesh.Effect      = effect;
            sphereMesh.Technique   = "PBR";
            sphereMesh.DiffuseMaps = new TgcTexture[0];
            sphereMesh.RenderType  = TgcMesh.MeshRenderType.VERTEX_COLOR;
            sphere.Dispose();
        }
Esempio n. 6
0
        private void InitializePBRMesh()
        {
            // Got to set a texture, else the translation to mesh does not map UV
            var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, MediaDir + "Texturas\\white.bmp");

            var sphere = new TGCSphere();

            sphere.Radius        = 40.0f;
            sphere.LevelOfDetail = 3;
            sphere.setTexture(texture);
            sphere.updateValues();

            pbrMesh             = sphere.toMesh("sphere");
            pbrMesh.Effect      = effect;
            pbrMesh.Technique   = "PBRIBL";
            pbrMesh.DiffuseMaps = new TgcTexture[0];
            pbrMesh.RenderType  = TgcMesh.MeshRenderType.VERTEX_COLOR;
            sphere.Dispose();

            var texturePath = MediaDir + "Texturas\\";

            var scaling = TGCMatrix.Scaling(TGCVector3.One * 25f);
            var harsh   = new PBRTexturedMesh("Harsh-Metal", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 100f), pbrMesh);
            var gold    = new PBRTexturedMesh("Gold", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 0f), pbrMesh);
            var marble  = new PBRTexturedMesh("Marble", texturePath, scaling * TGCMatrix.Translation(0f, 100f, -100f), pbrMesh);
            var ground  = new PBRTexturedMesh("Ground", texturePath, scaling * TGCMatrix.Translation(0f, 100f, -200f), pbrMesh);
            var metal   = new PBRTexturedMesh("Metal", texturePath, scaling * TGCMatrix.Translation(0f, 100f, 200f), pbrMesh);

            pbrTexturedMeshes.AddRange(new List <PBRTexturedMesh> {
                harsh, gold, marble, ground, metal
            });

            var greenSomething = new PBRMesh(new TGCVector3(0.05f, 0.74f, 0.3f), 0.5f, 0.5f, scaling * TGCMatrix.Translation(0f, 100f, 400f), pbrMesh);
            var redRubber      = new PBRMesh(new TGCVector3(1f, 0.05f, 0.1f), 0.1f, 0.9f, scaling * TGCMatrix.Translation(0f, 100f, 300f), pbrMesh);
            var blueMetal      = new PBRMesh(new TGCVector3(0f, 0.2f, 1.0f), 0.75f, 0.3f, scaling * TGCMatrix.Translation(0f, 100f, -300f), pbrMesh);

            pbrMeshes.AddRange(new List <PBRMesh> {
                redRubber, blueMetal, greenSomething
            });
        }