Exemplo n.º 1
0
        public override void Render()
        {
            PreRender();

            gui_render(ElapsedTime);

            if (profiling)
            {
                Device   device   = D3DDevice.Instance.Device;
                Viewport ant_view = device.Viewport;
                Viewport view     = new Viewport();
                view.X      = (int)(400 * gui.ex);
                view.Y      = (int)(100 * gui.ey);
                view.Width  = (int)(400 * gui.ex);
                view.Height = (int)(300 * gui.ey);
                view.MinZ   = 0;
                view.MaxZ   = 1;

                device.Viewport = view;

                mesh.Render();

                device.Viewport = ant_view;
            }

            PostRender();
        }
Exemplo n.º 2
0
        public void RenderObject(TgcSkeletalMesh x)
        {
            var e = x.Effect;
            var t = x.Technique;

            if (useShadows)
            {
                x.Effect    = shadowEffect;
                x.Effect    = skeletalShadowEffect;
                x.Technique = doingShadowRender ? "RenderShadow" : "RenderScene";
            }
            x.Render();
            x.Technique = t;
            x.Effect    = e;
            x.Render();
        }
Exemplo n.º 3
0
        public override void Render()
        {
            PreRender();

            gui_render(ElapsedTime);

            if (profiling)
            {
                Device   device   = D3DDevice.Instance.Device;
                Viewport ant_view = device.Viewport;
                Viewport view     = new Viewport();
                view.X      = (int)(400 * gui.ex);
                view.Y      = (int)(100 * gui.ey);
                view.Width  = (int)(400 * gui.ex);
                view.Height = (int)(300 * gui.ey);
                view.MinZ   = 0;
                view.MaxZ   = 1;

                device.Viewport = view;

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

                device.Viewport = ant_view;
            }

            PostRender();
        }
Exemplo n.º 4
0
        public void Render()
        {
            //Render personaje
            var transformacionesDelPersonaje = matrizRotacionPersonajeY * matrizEscalaPersonaje * matrizPosicionamientoPersonaje;

            personaje.Transform = transformacionesDelPersonaje;
            personaje.BoundingBox.transform(transformacionesDelPersonaje);

            personaje.Render();

            personaje.animateAndRender(GModel.ElapsedTime);
        }
Exemplo n.º 5
0
        public override void Render()
        {
            PreRender();

            mesh.Render();

            //Se puede renderizar todo mucho mas simple (sin esqueleto) de la siguiente forma:
            //mesh.animateAndRender();

            //BoundingBox
            var showBB = boundingBoxModifier.Value;

            if (showBB)
            {
                mesh.BoundingBox.Render();
            }

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

            //Ver si cambio la animacion
            var anim = animationModifier.Value.ToString();

            if (!anim.Equals(selectedAnim))
            {
                //Ver si animamos con o sin loop
                var animateWithLoop = loopModifier.Value;
                var frameRate       = frameRateModifier.Value;

                //Cargar nueva animacion elegida
                selectedAnim = anim;
                mesh.playAnimation(selectedAnim, animateWithLoop, frameRate);
            }

            //Ver si rendeizamos el esqueleto
            var renderSkeleton = renderSkeletonModifier.Value;

            //Ver si cambio el color
            var selectedColor = colorModifier.Value;

            if (currentColor == null || currentColor != selectedColor)
            {
                currentColor = selectedColor;
                mesh.setColor(currentColor);
            }

            //Agregar o quitar Attachment
            var showAttachmentFlag = attachmentModifier.Value;

            if (showAttachment != showAttachmentFlag)
            {
                showAttachment = showAttachmentFlag;
                if (showAttachment)
                {
                    //Al agregar el attachment, el modelo se encarga de renderizarlo en forma automatica
                    attachment.Mesh.Enabled = true;
                    mesh.Attachments.Add(attachment);
                }
                else
                {
                    attachment.Mesh.Enabled = false;
                    mesh.Attachments.Remove(attachment);
                }
            }

            //Actualizar animacion
            mesh.updateAnimation(ElapsedTime);

            //Solo malla o esqueleto, depende lo seleccionado
            mesh.RenderSkeleton = renderSkeleton;
            mesh.Render();

            //Se puede renderizar todo mucho mas simple (sin esqueleto) de la siguiente forma:
            //mesh.animateAndRender();

            //BoundingBox
            var showBB = boundingBoxModifier.Value;

            if (showBB)
            {
                mesh.BoundingBox.Render();
            }

            PostRender();
        }