Exemplo n.º 1
0
        public void Render(ShaderManager.MESH_TYPE tipo)
        {
            switch (tipo)
            {
            case ShaderManager.MESH_TYPE.DYNAMIC_ILLUMINATION_METALLIC:
                if (vivo)
                {
                    xwing.Render();
                    alaXwing.Render();
                }
                break;

            case ShaderManager.MESH_TYPE.SHADOW:
                if (vivo && false)
                {
                    xwing.Render();
                    alaXwing.Render();
                }
                break;

            case ShaderManager.MESH_TYPE.DEAD:
                if (!vivo)
                {
                    xwing.Render();
                    alaXwing.Render();
                }
                break;
            }
        }
Exemplo n.º 2
0
        public void Render()
        {
            // Renderizar la malla del auto, en este caso solo el Chasis
            Mesh.Transform = TGCMatrix.Translation(new TGCVector3(0, meshAxisRadius.Y - (meshRealHeight / 2f), 0)) * new TGCMatrix(rigidBody.InterpolationWorldTransform);
            Mesh.Render();

            TGCMatrix wheelTransform;

            // Como las ruedas no son cuerpos rigidos (aún) se procede a realizar las transformaciones de las ruedas para renderizar
            wheelTransform  = TGCMatrix.RotationY(vehicle.GetSteeringValue(0)) * TGCMatrix.RotationTGCQuaternion(new TGCQuaternion(RigidBody.Orientation.X, RigidBody.Orientation.Y, RigidBody.Orientation.Z, RigidBody.Orientation.W)) * TGCMatrix.Translation(new TGCVector3(vehicle.GetWheelInfo(0).WorldTransform.Origin));
            wheel.Transform = wheelTransform;
            wheel.Render();

            wheelTransform  = TGCMatrix.RotationY(vehicle.GetSteeringValue(1) + FastMath.PI) * TGCMatrix.RotationTGCQuaternion(new TGCQuaternion(RigidBody.Orientation.X, RigidBody.Orientation.Y, RigidBody.Orientation.Z, RigidBody.Orientation.W)) * TGCMatrix.Translation(new TGCVector3(vehicle.GetWheelInfo(1).WorldTransform.Origin));
            wheel.Transform = wheelTransform;
            wheel.Render();

            wheelTransform  = TGCMatrix.RotationY(-vehicle.GetSteeringValue(2)) * TGCMatrix.RotationTGCQuaternion(new TGCQuaternion(RigidBody.Orientation.X, RigidBody.Orientation.Y, RigidBody.Orientation.Z, RigidBody.Orientation.W)) * TGCMatrix.Translation(new TGCVector3(vehicle.GetWheelInfo(2).WorldTransform.Origin));
            wheel.Transform = wheelTransform;
            wheel.Render();

            wheelTransform  = TGCMatrix.RotationY(-vehicle.GetSteeringValue(3) + FastMath.PI) * TGCMatrix.RotationTGCQuaternion(new TGCQuaternion(RigidBody.Orientation.X, RigidBody.Orientation.Y, RigidBody.Orientation.Z, RigidBody.Orientation.W)) * TGCMatrix.Translation(new TGCVector3(vehicle.GetWheelInfo(3).WorldTransform.Origin));
            wheel.Transform = wheelTransform;
            wheel.Render();
        }
        public void renderPostProcess()
        {
            gameObjects.ForEach(g => g.Render());

            zombie.Render();
            globo.Render();
        }
Exemplo n.º 4
0
 public void Render(ShaderManager.MESH_TYPE tipo)
 {
     switch (tipo)
     {
     case ShaderManager.MESH_TYPE.SHADOW:
         if (!terminado)
         {
             bomba.Render();
         }
         break;
     }
 }
        public override void Renderizar()
        {
            //Dibujamos la escena
            scene.RenderAll();

            //Dibujar la primera plataforma en pantalla
            plataforma1Mesh.Transform = transformacionBox;
            plataforma1Mesh.Render();
            plataforma1Mesh.BoundingBox.transform(plataforma1Mesh.Transform);
            plataforma1Mesh.BoundingBox.Render();

            //Dibujar la segunda plataforma en pantalla
            plataforma2Mesh.Transform = transformacionBox2;
            plataforma2Mesh.Render();
            plataforma2Mesh.BoundingBox.transform(plataforma2Mesh.Transform);
            plataforma2Mesh.BoundingBox.Render();

            if (contexto.BoundingBox)
            {
                planoBack.BoundingBox.Render();
                //planoFront.BoundingBox.Render();
                planoIzq.BoundingBox.Render();
                planoDer.BoundingBox.Render();
                planoPiso.BoundingBox.Render();
                plataforma1.RenderizaRayos();
                //plataforma2.RenderizaRayos();
            }

            //Recalculamos la orbita de rotacion
            orbitaDeRotacion += MOVEMENT_SPEED * contexto.ElapsedTime;
        }
Exemplo n.º 6
0
 public void Render(ShaderManager.MESH_TYPE tipo)
 {
     switch (tipo)
     {
     case ShaderManager.MESH_TYPE.SHADOW: obstaculo.Render(); break;
     }
 }
Exemplo n.º 7
0
 public void Render(ShaderManager.MESH_TYPE tipo)
 {
     switch (tipo)
     {
     case ShaderManager.MESH_TYPE.DEFAULT: worldsphere.Render(); break;
     }
 }
Exemplo n.º 8
0
        public override void Render()
        {
            //BackgroundColor
            D3DDevice.Instance.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
            BeginScene();
            ClearTextures();

            //Cargar variables shader
            mesh.Effect.SetValue("ambientColor", ColorValue.FromColor(Color.Gray));
            mesh.Effect.SetValue("diffuseColor", ColorValue.FromColor(Color.LightBlue));
            mesh.Effect.SetValue("specularColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("specularExp", 10f);
            mesh.Effect.SetValue("lightPosition", lightPos);
            mesh.Effect.SetValue("eyePosition", TGCVector3.Vector3ToFloat4Array(Camara.Position));

            mesh.RotateY(-ElapsedTime / 2);
            mesh.Transform = TGCMatrix.Scaling(mesh.Scale)
                             * TGCMatrix.RotationYawPitchRoll(mesh.Rotation.Y, mesh.Rotation.X, mesh.Rotation.Z)
                             * TGCMatrix.Translation(mesh.Position);
            mesh.Render();

            textHelp.render();

            //Help
            if (Input.keyPressed(Key.H))
            {
                helpForm.ShowDialog();
            }

            PostRender();
        }
Exemplo n.º 9
0
        public void RenderScene(bool shadow)
        {
            foreach (var T in scene.Meshes)
            {
                if (shadow)
                {
                    T.Technique = "RenderShadow";
                }
                else
                {
                    T.Technique = "RenderScene";
                }

                T.Render();
            }

            // avion
            if (shadow)
            {
                avion.Technique = "RenderShadow";
            }
            else
            {
                avion.Technique = "RenderScene";
            }
            avion.Render();
        }
Exemplo n.º 10
0
        public override void Render()
        {
            //BackgroundColor
            D3DDevice.Instance.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
            BeginScene();
            ClearTextures();

            //Actualizar transformacion y renderizar el sol
            sun.Transform = getSunTransform(ElapsedTime);
            sun.Render();

            //Actualizar transformacion y renderizar la tierra
            earth.Transform = getEarthTransform(ElapsedTime);
            earth.Render();

            //Actualizar transformacion y renderizar la luna
            moon.Transform = getMoonTransform(ElapsedTime, earth.Transform);
            moon.Render();

            axisRotation       += AXIS_ROTATION_SPEED * ElapsedTime;
            earthAxisRotation  += EARTH_AXIS_ROTATION_SPEED * ElapsedTime;
            earthOrbitRotation += EARTH_ORBIT_SPEED * ElapsedTime;
            moonOrbitRotation  += MOON_ORBIT_SPEED * ElapsedTime;

            //Limpiamos todas las transformaciones con la TGCMatrix identidad
            D3DDevice.Instance.Device.Transform.World = TGCMatrix.Identity.ToMatrix();

            PostRender();
        }
Exemplo n.º 11
0
        public override void Render()
        {
            //BackgroundColor
            D3DDevice.Instance.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
            BeginScene();
            ClearTextures();

            //Cargar variables shader
            mesh.Effect.SetValue("ambientColor", ColorValue.FromColor(Color.Gray));
            mesh.Effect.SetValue("diffuseColor", ColorValue.FromColor(Color.LightBlue));
            mesh.Effect.SetValue("specularColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("specularExp", 10f);
            mesh.Effect.SetValue("lightPosition", lightPos);
            mesh.Effect.SetValue("eyePosition", TGCVector3.TGCVector3ToFloat4Array(Camera.Position));

            mesh.Render();

            textHelp.render();

            //Help
            if (Input.keyPressed(Key.H))
            {
                helpForm.ShowDialog();
            }

            PostRender();
        }
Exemplo n.º 12
0
 public override void Render()
 {
     PreRender();
     sphereMesh.Render();
     lightBoxes.ForEach(lightBox => lightBox.Render());
     PostRender();
 }
 public override void Render()
 {
     body.Translate(new Vector3(0, -35, 0));
     bomba.Position = new TGCVector3(bomba.Position.X, body.InterpolationWorldTransform.M42, bomba.Position.Z);
     bomba.Render();
     //semiesfera.Render();
 }
 public void Render()
 {
     if (Visible)
     {
         mesh.Render();
     }
 }
 public void Render()
 {
     if (!estaOculto)
     {
         mesh.Render();
         RenderEntity();
     }
 }
Exemplo n.º 16
0
 public void Render()
 {
     if (this.IsInView())
     {
         Lighting.LightManager.GetInstance().DoLightMe(mesh);
         mesh.Render();
         plane.BoundingBox.Render();
     }
 }
Exemplo n.º 17
0
        public override void Render()
        {
            PreRender();
            DrawText.drawText("Cantidad de elementos liberados: " + disposed, 5, 20, Color.Red);

            //Renderisamos todo hasta que pase cierto tiempo y ahi liberamos todos los recursos.
            if (time >= 0f && time < 30f)
            {
                var d3dMesh = new Mesh(boxMesh.NumberTriangles, boxMesh.NumberVertices, MeshFlags.Managed,
                                       TgcSceneLoader.VertexColorVertexElements, D3DDevice.Instance.Device);

                var origVert = (TgcSceneLoader.VertexColorVertex[])boxMesh.D3dMesh.LockVertexBuffer(
                    typeof(TgcSceneLoader.VertexColorVertex), LockFlags.ReadOnly, boxMesh.D3dMesh.NumberVertices);

                boxMesh.D3dMesh.UnlockVertexBuffer();

                var newVert = (TgcSceneLoader.VertexColorVertex[])d3dMesh.LockVertexBuffer(
                    typeof(TgcSceneLoader.VertexColorVertex), LockFlags.None, d3dMesh.NumberVertices);

                for (var i = 0; i < origVert.Length; i++)
                {
                    newVert[i]             = origVert[i];
                    newVert[i].Position.Y += time;
                }

                d3dMesh.UnlockVertexBuffer();

                boxMesh.changeD3dMesh(d3dMesh);

                //Render de todas las palmeras.
                foreach (var m in meshes)
                {
                    m.Render();
                }

                //Render de una esena.
                scene1.RenderAll();

                //Render de la caja.
                boxMesh.Render();

                time += ElapsedTime;
            }
            else
            {
                //ATENCION ESTO QUE SIGUE es solo para el ejemplo este, no es buena practica invocar al dispose completo.
                //En su lugar se puede invocar caso por caso segun las necidades.
                //Hacemos el dispose 1 vez sola.
                if (time != -1)
                {
                    time = -1;
                    Dispose();
                }
            }

            PostRender();
        }
Exemplo n.º 18
0
        public override void Render()
        {
            PreRender();

            eulerMesh.Render();
            quaternionMesh.Render();

            PostRender();
        }
Exemplo n.º 19
0
        public void Render(float ElapsedTime, float Rotation)
        {
            if (expired)
            {
                return;
            }

            time += ElapsedTime;
            explosionMesh.Effect.SetValue("time2", time);
            ringMesh.Effect.SetValue("time2", time);

            if (FastMath.PI + 1 < time * 2.2f)
            {
                expired = true;
                return;
            }

            explosionMesh.Render();
            ringMesh.Rotation = new TGCVector3(0, Rotation, 0);
            ringMesh.Render();

            if (FastMath.Max(FastMath.Sin(time * 2.2f), 0) > 0.2f)
            {
                emitter.Playing = true;
            }
            else
            {
                emitter.Playing = false;
            }

            rnd = (float)randomGenerator.NextDouble();

            emitter.Speed = new TGCVector3(rnd * 130, 19, rnd * 130) * 0.5f;

            if (rnd < 0.25f)
            {
                emitter.Position = new TGCVector3(initialPos.X + 4 * neg, initialPos.Y, initialPos.Z);
            }
            else if (rnd < 0.5f)
            {
                emitter.Position = new TGCVector3(initialPos.X, initialPos.Y + 4 * neg, initialPos.Z);
            }
            else if (rnd < 0.75f)
            {
                emitter.Position = new TGCVector3(initialPos.X, initialPos.Y, initialPos.Z + 3 * neg);
            }

            emitter.render(ElapsedTime);

            emitter2.Position = new TGCVector3(emitter.Position.X + neg * -8, emitter.Position.Y + neg * -8, emitter.Position.Z);
            emitter2.Speed    = emitter.Speed;
            emitter2.Playing  = emitter.Playing;
            emitter2.render(ElapsedTime);

            neg = neg * -1;
        }
Exemplo n.º 20
0
        public void Render()
        {
            //Se hace el transform a la posicion que devuelve el el Rigid Body del personaje
            personaje.Position  = new TGCVector3(personajeBody.CenterOfMassPosition.X, personajeBody.CenterOfMassPosition.Y - 27, personajeBody.CenterOfMassPosition.Z);//-27 para que no toque el piso pero casi (para que toque el piso -30)
            personaje.Transform = TGCMatrix.Translation(personajeBody.CenterOfMassPosition.X, personajeBody.CenterOfMassPosition.Y, personajeBody.CenterOfMassPosition.Z);

            personaje.Render();

            terreno.Render();
        }
Exemplo n.º 21
0
 public override void Render()
 {
     PreRender();
     shark.Render();
     fromArrow.Render();
     toArrow.Render();
     crossArrow.Render();
     sphere.Render();
     PostRender();
 }
Exemplo n.º 22
0
 public void Render(ShaderManager.MESH_TYPE tipo)
 {
     if (isVisible)
     {
         switch (tipo)
         {
         case ShaderManager.MESH_TYPE.SHADOW: torreta.Render(); break;
         }
     }
 }
Exemplo n.º 23
0
        public override void Render()
        {
            Device d3dDevice = D3DDevice.Instance.Device;

            time += ElapsedTime;
            // animo la pos del avion
            float alfa = -time *Geometry.DegreeToRadian(115.0f);

            avion.Position  = new TGCVector3(80f * (float)Math.Cos(alfa), 20 - 20 * (float)Math.Sin(alfa), 80f * (float)Math.Sin(alfa));
            dir_avion       = new TGCVector3(-(float)Math.Sin(alfa), 0, (float)Math.Cos(alfa));
            avion.Transform = CalcularMatriz(avion.Position, avion.Scale, dir_avion);
            g_LightPos      = lightLookFromModifier.Value;

            d3dDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            // dibujo la escena pp dicha
            d3dDevice.BeginScene();
            d3dDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);

            // piso
            scene.Meshes[0].Technique = "RenderScene";
            scene.Meshes[0].Render();

            // dibujo las sombra del avion sobre el piso
            effect.SetValue("matViewProj", d3dDevice.Transform.View * d3dDevice.Transform.Projection);
            effect.SetValue("g_vLightPos", new TGCVector4(g_LightPos.X, g_LightPos.Y, g_LightPos.Z, 1));
            d3dDevice.RenderState.ZBufferEnable = false;
            avion.Technique = "RenderShadows";
            avion.Render();
            d3dDevice.RenderState.ZBufferEnable = true;

            // avion
            avion.Technique = "RenderScene";
            avion.Render();

            // dibujo la luz
            box.setPositionSize(g_LightPos, new TGCVector3(5, 5, 5));
            box.updateValues();
            box.Render();

            PostRender();
        }
Exemplo n.º 24
0
 public override void render()
 {
     if (editablePolyEnabled)
     {
         EditablePoly.render();
     }
     else
     {
         mesh.Render();
     }
 }
Exemplo n.º 25
0
 public void render()
 {
     if (GameModel.debugMeshes)
     {
         mesh.Effect = actualShader;
         actualShader.SetValue("type", type);
         mesh.Technique = actualTechnique;
         mesh.Transform = multMatrix(g.map.deforming, deformation) + originalMesh;//mesh se transforma siempre porque se comparte
         mesh.Render();
     }
 }
Exemplo n.º 26
0
        public void renderScene(float elapsedTime, string Technique)
        {
            //Dibujamos todos los meshes del escenario

            /*foreach (TgcMesh m in meshes)
             * {
             *  m.Effect = effect;
             *  m.Technique = Technique;
             *  m.UpdateMeshTransform();
             *  m.render();
             * }*/

            var rnd = new Random(1);

            pasto.Effect    = effect;
            pasto.Technique = Technique;
            for (var i = 0; i < 10; ++i)
            {
                for (var j = 0; j < 10; ++j)
                {
                    pasto.Position = new TGCVector3(-i * 200 + rnd.Next(0, 50), 0, -j * 200 + rnd.Next(0, 50));
                    pasto.Scale    = new TGCVector3(3, 4 + rnd.Next(0, 4), 5);
                    pasto.UpdateMeshTransform();
                    //pasto.Transform = TGCMatrix.Identity*TGCMatrix.Scaling(3, 4 + rnd.Next(0, 4), 5) * TGCMatrix.Translation(-i * 200 + rnd.Next(0, 50), 0, -j * 200 + rnd.Next(0, 50));
                    pasto.Render();
                }
            }

            arbusto.Effect    = effect;
            arbusto.Technique = Technique;
            for (var i = 0; i < 5; ++i)
            {
                for (var j = 0; j < 5; ++j)
                {
                    arbusto.Position = new TGCVector3(-i * 400 + rnd.Next(0, 50), 0, -j * 400 + rnd.Next(0, 50));
                    //arbusto.Transform = TGCMatrix.Identity*TGCMatrix.Translation(-i * 400 + rnd.Next(0, 50), 0, -j * 400 + rnd.Next(0, 50));
                    arbusto.UpdateMeshTransform();
                    arbusto.Render();
                }
            }

            arbol.Effect    = effect;
            arbol.Technique = Technique;
            for (var i = 0; i < 3; ++i)
            {
                for (var j = 0; j < 3; ++j)
                {
                    arbol.Position = new TGCVector3(-i * 700 + rnd.Next(0, 50), 0, -j * 700 + rnd.Next(0, 50));
                    //arbol.Transform = TGCMatrix.Identity*TGCMatrix.Translation(-i * 700 + rnd.Next(0, 50), 0, -j * 700 + rnd.Next(0, 50));
                    arbol.UpdateMeshTransform();
                    arbol.Render();
                }
            }
        }
Exemplo n.º 27
0
 public override void Render()
 {
     D3DDevice.Instance.Device.Clear(Microsoft.DirectX.Direct3D.ClearFlags.Target | Microsoft.DirectX.Direct3D.ClearFlags.ZBuffer, Color.White, 1.0f, 0);
     D3DDevice.Instance.Device.BeginScene();
     pasto.Render();
     paredes.Render();
     skyBox.Render();
     drawer2D.BeginDrawSprite();
     drawer2D.DrawSprite(unSprite);
     drawer2D.EndDrawSprite();
 }
Exemplo n.º 28
0
        /// <summary>
        ///     Se llama cada vez que hay que refrescar la pantalla.
        ///     Escribir aquí todo el código referido al renderizado.
        ///     Borrar todo lo que no haga falta.
        /// </summary>
        public override void Render()
        {
            //Inicio el render de la escena, para ejemplos simples. Cuando tenemos postprocesado o shaders es mejor realizar las operaciones según nuestra conveniencia.
            PreRender();

            cajaUno.Render();
            cajaDos.Render();
            cajaTres.Render();

            //Finaliza el render y presenta en pantalla, al igual que el preRender se debe para casos puntuales es mejor utilizar a mano las operaciones de EndScene y PresentScene
            PostRender();
        }
Exemplo n.º 29
0
            public void Apply()
            {
                mesh.Transform = transform;
                var meshEffect = mesh.Effect;

                meshEffect.SetValue("textured", false);
                meshEffect.SetValue("albedoValue", TGCVector3.TGCVector3ToFloat3Array(albedo));
                meshEffect.SetValue("metallicValue", metallic);
                meshEffect.SetValue("roughnessValue", roughness);

                mesh.Render();
            }
Exemplo n.º 30
0
        public override void Render()
        {
            PreRender();

            //Dibujar el modelo 3D
            mesh.Render();

            //Dibujar la escena entera
            scene.RenderAll();

            PostRender();
        }