Ejemplo n.º 1
0
        public override void Initialize()
        {
            _vertices=new []
                          {
                              //new VertexN3fV3f(new Vector3(-1,-1,-1), MinBounding.X,MinBounding.Y,MinBounding.Z),
                              //new VertexN3fV3f(new Vector3(-1,-1,1),MinBounding.X,MinBounding.Y,MaxBounding.Z),
                              //new VertexN3fV3f(new Vector3(1,-1,1),MaxBounding.X,MinBounding.Y,MaxBounding.Z),
                              //new VertexN3fV3f(new Vector3(1,-1,-1),MaxBounding.X,MinBounding.Y,MinBounding.Z),
                              //new VertexN3fV3f(new Vector3(-1,1,-1),MinBounding.X,MaxBounding.Y,MinBounding.Z),
                              //new VertexN3fV3f(new Vector3(-1,1,1),MinBounding.X,MaxBounding.Y,MaxBounding.Z),
                              //new VertexN3fV3f(new Vector3(1,1,1),MaxBounding.X,MaxBounding.Y,MaxBounding.Z),
                              //new VertexN3fV3f(new Vector3(1,1,-1),MaxBounding.X,MaxBounding.Y,MinBounding.Z),

                              new VertexC4ubV3f(MinBounding.X,MinBounding.Y,MinBounding.Z,Color.LightSteelBlue),
                              new VertexC4ubV3f(MinBounding.X,MinBounding.Y,MaxBounding.Z,Color.LightSteelBlue),
                              new VertexC4ubV3f(MaxBounding.X,MinBounding.Y,MaxBounding.Z,Color.LightSteelBlue),
                              new VertexC4ubV3f(MaxBounding.X,MinBounding.Y,MinBounding.Z,Color.LightSteelBlue),
                              new VertexC4ubV3f(MinBounding.X,MaxBounding.Y,MinBounding.Z,Color.DodgerBlue),
                              new VertexC4ubV3f(MinBounding.X,MaxBounding.Y,MaxBounding.Z,Color.DodgerBlue),
                              new VertexC4ubV3f(MaxBounding.X,MaxBounding.Y,MaxBounding.Z,Color.DodgerBlue),
                              new VertexC4ubV3f(MaxBounding.X,MaxBounding.Y,MinBounding.Z,Color.DodgerBlue),

                          };
            _indices = new short[]
                           {
                               0, 1, 5, 5, 4, 0,
                               1, 2, 6, 6, 5, 1,
                               2, 3, 7, 7, 6, 2,
                               3, 0, 4, 4, 7, 3,
                               4, 5, 6, 6, 7, 4,
                           };

            _boundingBoxVertexBufferObject = VertexBufferObject.LoadVBO(_vertices, _indices, BufferUsageHint.StaticDraw);

            Textures.TextureLoaderParameters.FlipImages = false;
            Textures.TextureLoaderParameters.MagnificationFilter = TextureMagFilter.Linear;
            Textures.TextureLoaderParameters.MinificationFilter = TextureMinFilter.Linear;
            Textures.TextureLoaderParameters.WrapModeS = TextureWrapMode.ClampToEdge;
            Textures.TextureLoaderParameters.WrapModeT = TextureWrapMode.ClampToEdge;
            Textures.TextureLoaderParameters.EnvMode = TextureEnvMode.Modulate;
            ImageDDS.LoadFromDisk(_texture, out _textureIndex, out _textureTarget);

            _shaderParameters = Shaders.ShaderTextureParameters.GetShaderTextureParameters(this.GetType());

            _boundingBoxShader.UseShader = false;
            base.Initialize();
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            _earthShader.UseShader = true;

            GL.Disable(EnableCap.Dither);
            GL.Enable(EnableCap.CullFace);
            GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);
            //GL.PolygonMode(MaterialFace.Back, PolygonMode.Line);
            //Textures
            Textures.TextureLoaderParameters.FlipImages = false;
            Textures.TextureLoaderParameters.MagnificationFilter = TextureMagFilter.Linear;
            Textures.TextureLoaderParameters.MinificationFilter = TextureMinFilter.Linear;
            Textures.TextureLoaderParameters.WrapModeS = TextureWrapMode.ClampToEdge;
            Textures.TextureLoaderParameters.WrapModeT = TextureWrapMode.ClampToEdge;
            Textures.TextureLoaderParameters.EnvMode = TextureEnvMode.Modulate;
            ImageDDS.LoadFromDisk(TMU0Filename, out TMU0_Handler, out TMU0_Target);
            _shaderParameters = Shaders.ShaderTextureParameters.GetShaderTextureParameters(this.GetType());
            Radius = 30;
            sphere = new SlicedSphere(Radius, Vector3d.Zero, SlicedSphere.eSubdivisions.Five,
                                      new SlicedSphere.eDir[] {SlicedSphere.eDir.All}, true);
            base.Initialize();
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            _terrainShader.UseShader = true;
            _triangleVertices = new VertexT2fC3fV3f[_xNumber * _zNumber];

            vertexHeight = LoadTerrain(terrainFile, out minHeight, out maxHeight);
            if (vertexHeight != null)
            {
                InitializeVertices();
                triangleElements = rectangleIndices.ToArray();
                _terrainVertexBufferObject = VertexBufferObject.LoadVBO(_triangleVertices, triangleElements, BufferUsageHint.StaticDraw);
            }
            _shaderParameters = Shaders.ShaderTextureParameters.GetShaderTextureParameters(this.GetType());

            Textures.LoadGLTextures(_textures, ref _textureIndices);

            GL.Enable(EnableCap.Light0);
            GL.Light(LightName.Light0, LightParameter.SpotDirection, 0);
            GL.Light(LightName.Light0, LightParameter.Position, _sunVector);
            GL.Light(LightName.Light0, LightParameter.Ambient, Color.White);
            GL.Light(LightName.Light0, LightParameter.Diffuse, _sunColor);
            GL.Light(LightName.Light0, LightParameter.Specular, _sunColor);
            base.Initialize();
        }