Esempio n. 1
0
 public void CopyFrom(ViewSetting vs)
 {
     this.Material              = vs.Material;
     this.BackgroundColor       = vs.BackgroundColor;
     this.UseVertexBuffer       = vs.UseVertexBuffer;
     this.UseDrawElements       = vs.UseDrawElements;
     this.EnableCameraAnimation = vs.EnableCameraAnimation;
     this.PolygonOffsetFactor   = vs.PolygonOffsetFactor;
     this.PolygonOffsetUnits    = vs.PolygonOffsetUnits;
     this.SelectionBufferSize   = vs.SelectionBufferSize;
     this.DragZoomSign          = vs.DragZoomSign;
     this.WheelZoomSign         = vs.WheelZoomSign;
     this.LowerZoomScale        = vs.LowerZoomScale;
     this.UpperZoomScale        = vs.UpperZoomScale;
     this.ShowAxis              = vs.ShowAxis;
     this.ShowCompass           = vs.ShowCompass;
     this.ShowRuler             = vs.ShowRuler;
     this.ShaderName            = vs.ShaderName;
     this.AutoFocus             = vs.AutoFocus;
     this.ZoomToMousePosition   = vs.ZoomToMousePosition;
     this.ZKeptRotation         = vs.ZKeptRotation;
     vs.Bindings.CopyTo(this.Bindings);
     for (int i = 0; i < 4; ++i)
     {
         this.Lights[i].CopyFrom(vs.Lights[i]);
     }
 }
Esempio n. 2
0
        public void SetActiveMaterial(Graphics.Material material)
        {
            if (active_shader != material)
            {
                if (active_shader != null)
                {
                    active_shader.MakeNonCurrent();
                }

                active_shader = material;
                if (active_shader != null)
                {
                    active_shader.MakeCurrent();
                    var std = material as IStdShader;

                    if (std != null)
                    {
                        projection_matrix.uniform = std.Projection;
                        modelview_matrix.uniform  = std.ModelView;
                        texture_matrix.uniform    = std.Texture;
                        normal_matrix.uniform     = std.Normal;
                    }
                    active_shader.Shader.SetFragmentOutput("out_frag");
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initialise les paramètres du shader.
 /// </summary>
 void InitializeEffect()
 {
     m_material = new Graphics.Material(
         new Color4(1.0f, 0.48f, 0.48f, 0.48f), // ambient
         new Color4(1.0f, 0.88f, 0.88f, 0.88f), // diffuse
         new Color4(4.0f, 0.8f, 0.8f, 0.8f),
         new Color4(0, 0, 0, 0));
 }
Esempio n. 4
0
        public override void Init()
        {
            Mesh = new SynergyEngine.Mesh();
            Material = new Graphics.Material();

            Material.Init();
            Mesh.Init();
        }
 public Loader(DirectX3DGraphics directX3DGraphics, SamplerState state)
 {
     _directX3DGraphics = directX3DGraphics;
     _imagingFactory    = new ImagingFactory();
     samplerState       = state;
     defaultTexture     = LoadTextureFromFile("Textures\\white.png", true);
     defaultMaterial    = new Graphics.Material(defaultTexture, Vector3.Zero, Vector3.One, Vector3.One, Vector3.One, 1);
 }
Esempio n. 6
0
 public Graphics.Material GetMaterial(BinaryReader br)
 {
     Graphics.Material material = new Graphics.Material();
     material.attributes1 = attributes1;
     material.attributes2 = attributes2;
     material.unknown     = unknown;
     if (textureFilename1Offset != null)
     {
         br.BaseStream.Seek((long)textureFilename1Offset, SeekOrigin.Begin);
         material.textureFilename1 = Text.ReadText(br);
     }
     if (textureFilename2Offset != null)
     {
         br.BaseStream.Seek((long)textureFilename2Offset, SeekOrigin.Begin);
         material.textureFilename2 = Text.ReadText(br);
     }
     if (textureFilename3Offset != null)
     {
         br.BaseStream.Seek((long)textureFilename3Offset, SeekOrigin.Begin);
         material.textureFilename3 = Text.ReadText(br);
     }
     return(material);
 }
Esempio n. 7
0
        void createMeshes(Node node)
        {
            if (node.HasMeshes)
            {
                foreach (int meshIndex in node.MeshIndices)
                {
                    Assimp.Mesh amesh = myScene.Meshes[meshIndex];

                    //create the material
                    Graphics.Material mat = createMaterial(myScene.Materials[amesh.MaterialIndex]);

                    //create the geometry
                    Graphics.Mesh mesh = new Graphics.Mesh();
                    mesh.primativeType = OpenTK.Graphics.OpenGL.PrimitiveType.Triangles;
                    mesh.indexBase     = currIndexOffset;
                    mesh.indexCount    = amesh.FaceCount * 3;
                    mesh.material      = mat;

                    //get the indices
                    foreach (Face face in amesh.Faces)
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            index.Add((UInt16)(face.Indices[i] + currVertOffset));
                            currIndexOffset++;
                        }
                    }

                    //get the verts
                    for (int i = 0; i < amesh.VertexCount; i++)
                    {
                        V3N3T2 v = new V3N3T2();
                        v.Position = toVector(amesh.Vertices[i]);

                        if (amesh.HasNormals == true)
                        {
                            v.Normal = toVector(amesh.Normals[i]);
                        }

                        if (amesh.HasTextureCoords(0) == true)
                        {
                            v.TexCoord = toVector2D(amesh.TextureCoordinateChannels[0][i]);
                        }

                        myVerts.Add(v);
                    }

                    currVertOffset += amesh.VertexCount;

                    myModel.myMeshes.Add(mesh);
                }
            }

            if (node.HasChildren)
            {
                foreach (Node child in node.Children)
                {
                    createMeshes(child);
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Initialise les paramètres du shader.
 /// </summary>
 void InitializeEffect()
 {
     m_material = new Graphics.Material(
         new Color4(1.0f, 0.48f, 0.48f, 0.48f), // ambient
         new Color4(1.0f, 0.88f, 0.88f, 0.88f), // diffuse
         new Color4(4.0f, 0.8f, 0.8f, 0.8f),
         new Color4(0, 0, 0, 0));
 }