예제 #1
0
 public Terrain(float gridX, float gridZ, Loader loader, TerrainTexturePack texturePack, TerrainTexture blendMap, Bitmap hegihtMap)
 {
     this.texturePack = texturePack;
     this.blendMap    = blendMap;
     this.x           = gridX * SIZE;
     this.z           = gridZ * SIZE;
     this.model       = GenerateTerrain(loader, hegihtMap);
 }
예제 #2
0
 public SkyboxRenderer(Loader loader, Matrix4x4f projectionMatrix)
 {
     this.cube            = loader.LoadVAO(VERTICES, 3);
     this.textureID_day   = loader.LoadCubeMap(DAY_TEXTURE_FILES);
     this.textureID_night = loader.LoadCubeMap(NIGHT_TEXTURE_FILES);
     this.shader          = new SkyboxShader();
     this.shader.Start();
     this.shader.ConnectTextureUnits();
     this.shader.LoadProjectionMatrix(projectionMatrix);
     this.shader.Stop();
 }
예제 #3
0
        private void PrepareTerrain(Terrain terrain)
        {
            RawModel rawModel = terrain.Model;

            Gl.BindVertexArray(rawModel.VaoID);
            Gl.EnableVertexAttribArray(0); // Position
            Gl.EnableVertexAttribArray(1); // UV 매핑 데이터 Slot 활성
            Gl.EnableVertexAttribArray(2); // Normal
            BindTextures(terrain);
            this.shader.LoadShineVariables(SHINE_DAMPER, REFLECTIVITY);
        }
예제 #4
0
 public GUIRenderer(Loader loader)
 {
     float[] positions =
     {
         -1, 1,  //V1
         -1, -1, //V2
         1, 1,   //V3
         1, -1   //V4
     };
     this.quadModel = loader.LoadVAO(positions, 2);
     this.shader    = new GUIShader();
 }
예제 #5
0
        private void PrepareTextureModel(TextureModel model)
        {
            RawModel rawModel = model.RawModel;

            Gl.BindVertexArray(rawModel.VaoID);
            Gl.EnableVertexAttribArray(0); // Position
            Gl.EnableVertexAttribArray(1); // UV 매핑 데이터 Slot 활성
            Gl.EnableVertexAttribArray(2); // Normal

            ModelTexture texture = model.Texture;

            if (texture.HasTransparency)
            {
                MasterRenderer.DisableCulling();
            }

            this.shader.LoadFakeLighting(texture.UseFakeLigihting);
            this.shader.LoadShineVariables(texture.ShineDamper, texture.Reflectivity);
            Gl.ActiveTexture(TextureUnit.Texture0);
            Gl.BindTexture(TextureTarget.Texture2d, texture.TextureID);
        }
예제 #6
0
 private void SetUpVAO(Loader loader)
 {
     // Just x and z vectex positions here, y is set to 0 in v.shader
     float[] vertices = { -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1 };
     quad = loader.LoadVAO(vertices, 2);
 }
예제 #7
0
 private void PrepareTextureModel(RawModel model)
 {
     Gl.BindVertexArray(model.VaoID);
     Gl.EnableVertexAttribArray(0);// Position
 }