Ejemplo n.º 1
0
        public new MeshShader createMeshInstance(string name, Vector3 translation, Vector3 rotation, Vector3 scale)
        {
            if (this.parentInstance != null) {
                throw new Exception("No se puede crear una instancia de otra malla instancia. Hay que partir del original.");
            }

            //Crear instancia
            MeshShader instance = new MeshShader(name, this, translation, rotation, scale);
            //instance.effect = effect;

            //BoundingBox
            instance.boundingBox = new TgcBoundingBox(this.boundingBox.PMin, this.boundingBox.PMax);
            instance.updateBoundingBox();

            instance.enabled = true;
            return instance;
        }
Ejemplo n.º 2
0
        public Water()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            TgcSceneLoader loader = new TgcSceneLoader();
            loader.MeshFactory = new MeshShaderFactory();

            scene = loader.loadSceneFromFile(Path.WaterScene);
            mesh = (MeshShader)scene.Meshes[0];
            mesh.Scale = new Vector3(350f, 0.1f, 2200f);
            mesh.Position = new Vector3(0f, -20f, 0f);

            string compilationErrors;
            effect = Effect.FromFile(d3dDevice, Path.WaterShader, null, null, ShaderFlags.None, null, out compilationErrors);
            mesh.effect = effect;
            if (effect == null) GuiController.Instance.Logger.log(compilationErrors);

            effect.SetValue("textureOffset", 0.1f);
        }
Ejemplo n.º 3
0
Archivo: Tank.cs Proyecto: faloi/tegece
        public Tank(Vector3 initialPosition, Terrain.Terrain terrain, string scenePath)
        {
            var loader = new TgcSceneLoader { MeshFactory = new MeshShaderFactory() };
            var scene = loader.loadSceneFromFile(scenePath);
            this.mesh = (MeshShader) scene.Meshes[0];
            this.loadShader();

            this.terrain = terrain;
            missilesShooted = new List<Missile>();

            this.boundingSphere = new TgcBoundingSphere(this.mesh.BoundingBox.calculateBoxCenter(), this.mesh.BoundingBox.calculateBoxRadius()*3);

            this.mesh.AutoTransformEnable =  this.mesh.AutoUpdateBoundingBox = false;
            this.translationMatrix = Matrix.Identity;
            this.Position = initialPosition;

            this.setTranslationMatrix(initialPosition);
            this.totalSpeed = 0f;
            this.totalRotationSpeed = 100f;
            this.forwardVector = new Vector3(0, 0, -1);
        }