Ejemplo n.º 1
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(Bounds))
            {
                return(EmptyRenderInfo);
            }

            List <RenderInfo> result = new List <RenderInfo>();

            transform.Push();
            transform.NJTranslate(Position);
            transform.NJRotateY(Rotation.Y);
            transform.NJScale((Scale.X), (Scale.Y), (Scale.Z));

            RenderInfo outputInfo = new RenderInfo(VolumeMesh, 0, transform.Top, Material, null, FillMode.Solid, Bounds);

            if (Selected)
            {
                NJS_MATERIAL mat = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.White,
                    IgnoreLighting = true,
                    UseAlpha       = false
                };
                result.Add(new RenderInfo(VolumeMesh, 0, transform.Top, mat, null, FillMode.Wireframe, Bounds));
            }

            result.Add(outputInfo);

            transform.Pop();
            return(result);
        }
Ejemplo n.º 2
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(Bounds))
            {
                return(EmptyRenderInfo);
            }

            return(objdef.Render(this, dev, camera, transform));
        }
Ejemplo n.º 3
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(Bounds))
            {
                return(EmptyRenderInfo);
            }

            List <RenderInfo> result = new List <RenderInfo>();

            RenderInfo outputInfo = new RenderInfo(mesh, 0, Matrix.Identity, (Selected) ? SelectedMaterial : UnSelectedMaterial, null, EditorOptions.RenderFillMode, Bounds);

            result.Add(outputInfo);

            textSprite.Begin(SpriteFlags.AlphaBlend);

            Matrix view       = camera.ToMatrix();
            Matrix projection = Matrix.PerspectiveFovRH(camera.FOV, camera.Aspect, 1, camera.DrawDistance);

            if (Selected)
            {
                for (int vIndx = 0; vIndx < splineData.Path.Count(); vIndx++)
                {
                    #region Draw Vertex IDs
                    Vector3 screenCoordinates = Vector3.Project(new Vector3(splineData.Path[vIndx].Position.X, splineData.Path[vIndx].Position.Y, splineData.Path[vIndx].Position.Z),
                                                                dev.Viewport, projection, view, Matrix.Identity);
                    Vector3 altScrCoord = Vector3.Project(new Vector3(splineData.Path[vIndx].Position.X, splineData.Path[vIndx].Position.Y, splineData.Path[vIndx].Position.Z),
                                                          dev.Viewport, dev.Transform.Projection, dev.Transform.View, Matrix.Identity);

                    EditorOptions.OnscreenFont.DrawText(textSprite, vIndx.ToString(), new Point((int)(screenCoordinates.X), (int)(screenCoordinates.Y)), Color.White);
                    #endregion

                    #region Draw Vertex Handles
                    transform.Push();

                    transform.Translate(splineData.Path[vIndx].Position.X, splineData.Path[vIndx].Position.Y, splineData.Path[vIndx].Position.Z);

                    result.Add(new RenderInfo(vertexHandleMesh, 0, transform.Top, UnSelectedMaterial, null, FillMode.Solid, new BoundingSphere(splineData.Path[vIndx].Position.X,
                                                                                                                                               splineData.Path[vIndx].Position.Y, splineData.Path[vIndx].Position.Z, 1f)));

                    if (vIndx == selectedKnot)
                    {
                        result.Add(new RenderInfo(vertexHandleMesh, 0, transform.Top, SelectedMaterial, null, FillMode.WireFrame, new BoundingSphere(splineData.Path[vIndx].Position.X,
                                                                                                                                                     splineData.Path[vIndx].Position.Y, splineData.Path[vIndx].Position.Z, 1f)));
                    }
                    transform.Pop();
                    #endregion
                }
            }

            textSprite.End();

            return(result);
        }
Ejemplo n.º 4
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(COL.Bounds))
            {
                return(EmptyRenderInfo);
            }

            List <RenderInfo> result = new List <RenderInfo>();

            if (!string.IsNullOrEmpty(LevelData.leveltexs))
            {
                result.AddRange(COL.Model.DrawModel(dev, transform, LevelData.Textures[LevelData.leveltexs], Mesh, Visible));
            }
            else
            {
                result.AddRange(COL.Model.DrawModel(dev, transform, null, Mesh, Visible));
            }
            if (Selected)
            {
                result.AddRange(COL.Model.DrawModelInvert(transform, Mesh, Visible));
            }
            return(result);
        }
Ejemplo n.º 5
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(COL.Bounds))
            {
                return(EmptyRenderInfo);
            }

            List <RenderInfo> result = new List <RenderInfo>();

            if (!string.IsNullOrEmpty(LevelData.leveltexs) && LevelData.Textures.Count > 0)
            {
                result.AddRange(COL.Model.DrawModel(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, LevelData.Textures[LevelData.leveltexs], Mesh, Visible, EditorOptions.IgnoreMaterialColors, EditorOptions.OverrideLighting));
            }
            else
            {
                result.AddRange(COL.Model.DrawModel(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, null, Mesh, Visible, EditorOptions.IgnoreMaterialColors, EditorOptions.OverrideLighting));
            }
            if (Selected)
            {
                result.AddRange(COL.Model.DrawModelInvert(transform, Mesh, Visible));
            }
            return(result);
        }
Ejemplo n.º 6
0
        public override List <RenderInfo> Render(Device dev, EditorCamera camera, MatrixStack transform)
        {
            if (!camera.SphereInFrustum(Bounds))
            {
                return(EmptyRenderInfo);
            }

            List <RenderInfo> result = new List <RenderInfo>();

            transform.Push();
            transform.NJTranslate(Position);
            transform.NJRotateY(Rotation.Y);

            switch (CollisionType)
            {
            case (SADXCamColType.CamCol_Sphere):
                VolumeMesh = Mesh.Sphere(2f, 6, 8);
                Material   = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.FromArgb(200, Color.Blue),
                    SpecularColor  = Color.Black,
                    UseAlpha       = true,
                    DoubleSided    = false,
                    Exponent       = 10,
                    IgnoreSpecular = false,
                    UseTexture     = false
                };
                transform.NJScale((Scale.X), (Scale.X), (Scale.X));
                break;

            case (SADXCamColType.CamCol_Plane):
                VolumeMesh = Mesh.Box(2f, 2f, 0f);
                Material   = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.FromArgb(200, Color.Green),
                    SpecularColor  = Color.Black,
                    UseAlpha       = true,
                    DoubleSided    = false,
                    Exponent       = 10,
                    IgnoreSpecular = false,
                    UseTexture     = false
                };
                transform.NJScale((Scale.X), (Scale.Y), (1f));
                break;

            case (SADXCamColType.CamCol_Block):
                VolumeMesh = Mesh.Box(2f, 2f, 2f);
                Material   = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.FromArgb(200, Color.Purple),
                    SpecularColor  = Color.Black,
                    UseAlpha       = true,
                    DoubleSided    = false,
                    Exponent       = 10,
                    IgnoreSpecular = false,
                    UseTexture     = false
                };
                transform.NJScale((Scale.X), (Scale.Y), (Scale.Z));
                break;

            default:
                VolumeMesh = Mesh.Sphere(2f, 6, 8);
                Material   = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.FromArgb(200, Color.Blue),
                    SpecularColor  = Color.Black,
                    UseAlpha       = true,
                    DoubleSided    = false,
                    Exponent       = 10,
                    IgnoreSpecular = false,
                    UseTexture     = false
                };
                transform.NJScale((Scale.X), (Scale.X), (Scale.X));
                break;
            }

            RenderInfo outputInfo = new RenderInfo(VolumeMesh, 0, transform.Top, Material, null, FillMode.Solid, Bounds);

            if (Selected)
            {
                NJS_MATERIAL mat = new NJS_MATERIAL
                {
                    DiffuseColor   = Color.White,
                    IgnoreLighting = true,
                    UseAlpha       = false
                };
                result.Add(new RenderInfo(VolumeMesh, 0, transform.Top, mat, null, FillMode.Wireframe, Bounds));
            }

            result.Add(outputInfo);

            transform.Pop();
            return(result);
        }