Пример #1
0
 public ModelViewer(string title, string name, IDrawable drawable, RenderState rstate, ViewportManager viewports, CommandBuffer commands, ResourceManager res)
 {
     Title                       = title;
     Name                        = name;
     this.drawable               = drawable;
     this.rstate                 = rstate;
     this.vps                    = viewports;
     this.res                    = res;
     buffer                      = commands;
     wireframeMaterial3db        = new Material(res);
     wireframeMaterial3db.Dc     = Color4.White;
     wireframeMaterial3db.DtName = ResourceManager.WhiteTextureName;
     normalsDebugMaterial        = new Material(res);
     normalsDebugMaterial.Type   = "NormalDebugMaterial";
     lighting                    = Lighting.Create();
     lighting.Enabled            = true;
     lighting.Ambient            = Color4.Black;
     lighting.Lights.Add(new RenderLight()
     {
         Kind      = LightKind.Directional,
         Direction = new Vector3(0, -1, 0),
         Color     = Color4.White
     });
     lighting.Lights.Add(new RenderLight()
     {
         Kind      = LightKind.Directional,
         Direction = new Vector3(0, 0, 1),
         Color     = Color4.White
     });
     lighting.NumberOfTilesX = -1;
     GizmoRender.Init(res);
 }
        void SetupViewport()
        {
            modelViewport         = new Viewport3D(_window);
            modelViewport.MarginH = 60;
            ResetCamera();
            previewViewport = new Viewport3D(_window);
            imageViewport   = new Viewport3D(_window);
            gizmoScale      = 5;
            if (vmsModel != null)
            {
                gizmoScale = vmsModel.GetRadius() / RADIUS_ONE;
            }
            else if (drawable is DF.DfmFile dfm)
            {
                gizmoScale = dfm.GetRadius() / RADIUS_ONE;
            }
            wireframeMaterial3db        = new Material(res);
            wireframeMaterial3db.Dc     = Color4.White;
            wireframeMaterial3db.DtName = ResourceManager.WhiteTextureName;
            normalsDebugMaterial        = new Material(res);
            normalsDebugMaterial.Type   = "NormalDebugMaterial";
            lighting         = Lighting.Create();
            lighting.Enabled = true;
            lighting.Ambient = Color3f.Black;
            var src = new SystemLighting();

            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, -1, 0),
                    Color     = Color3f.White
                }
            });
            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, 0, 1),
                    Color     = Color3f.White
                }
            });
            lighting.Lights.SourceLighting   = src;
            lighting.Lights.SourceEnabled[0] = true;
            lighting.Lights.SourceEnabled[1] = true;
            lighting.NumberOfTilesX          = -1;
            if (drawable is DF.DfmFile)
            {
                skel = new DfmSkeletonManager((DF.DfmFile)drawable);
            }
            GizmoRender.Init(res);
        }
Пример #3
0
        void SetupViewport()
        {
            modelViewport                  = new Viewport3D(_window);
            modelViewport.MarginH          = 60;
            modelViewport.DefaultOffset    =
                modelViewport.CameraOffset = new Vector3(0, 0, drawable.GetRadius() * 2);
            modelViewport.ModelScale       = drawable.GetRadius() / 2.6f;
            previewViewport                = new Viewport3D(_window);
            imageViewport                  = new Viewport3D(_window);

            gizmoScale                  = drawable.GetRadius() / RADIUS_ONE;
            wireframeMaterial3db        = new Material(res);
            wireframeMaterial3db.Dc     = Color4.White;
            wireframeMaterial3db.DtName = ResourceManager.WhiteTextureName;
            normalsDebugMaterial        = new Material(res);
            normalsDebugMaterial.Type   = "NormalDebugMaterial";
            lighting         = Lighting.Create();
            lighting.Enabled = true;
            lighting.Ambient = Color3f.Black;
            var src = new SystemLighting();

            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, -1, 0),
                    Color     = Color3f.White
                }
            });
            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, 0, 1),
                    Color     = Color3f.White
                }
            });
            lighting.Lights.SourceLighting   = src;
            lighting.Lights.SourceEnabled[0] = true;
            lighting.Lights.SourceEnabled[1] = true;
            lighting.NumberOfTilesX          = -1;
            GizmoRender.Init(res);
        }
Пример #4
0
        void SetupViewport()
        {
            modelViewport               = new Viewport3D(rstate, vps);
            modelViewport.Zoom          = drawable.GetRadius() * 2;
            modelViewport.ZoomStep      = modelViewport.Zoom / 3.26f;
            wireframeMaterial3db        = new Material(res);
            wireframeMaterial3db.Dc     = Color4.White;
            wireframeMaterial3db.DtName = ResourceManager.WhiteTextureName;
            normalsDebugMaterial        = new Material(res);
            normalsDebugMaterial.Type   = "NormalDebugMaterial";
            lighting         = Lighting.Create();
            lighting.Enabled = true;
            lighting.Ambient = Color4.Black;
            var src = new SystemLighting();

            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, -1, 0),
                    Color     = Color4.White
                }
            });
            src.Lights.Add(new DynamicLight()
            {
                Light = new RenderLight()
                {
                    Kind      = LightKind.Directional,
                    Direction = new Vector3(0, 0, 1),
                    Color     = Color4.White
                }
            });
            lighting.Lights.SourceLighting   = src;
            lighting.Lights.SourceEnabled[0] = true;
            lighting.Lights.SourceEnabled[1] = true;
            lighting.NumberOfTilesX          = -1;
            GizmoRender.Init(res);
        }