Code Monkey home page Code Monkey logo

3d-terrain-programming's Introduction

3D Terrain Programming

A serie of examples increasing the complexity example-by-example.

Based on Focus on 3D Terrain Rendering by Trent Polack.

1-Basic brute force

In: Delphi(GLScene)

Load a bitmap and render a very plain 3D Terrain without any optimization.

var
  z, x: integer;
  h: byte;
  y: single;
//***
for z := 0 to FHeightField.DimensionLength - 2 do
begin
  glBegin(GL_TRIANGLE_STRIP);
  for x := 0 to FHeightField.DimensionLength - 1 do
  begin
    h := FHeightField.GetValue(x, z);
    y := h * SCALE;
    glColor3ub(h, h, h);
    glVertex3f(x, y, z);

    h := FHeightField.GetValue(x, z + 1);
    y := h * SCALE;
    glColor3ub(h, h, h);
    glVertex3f(x, y, z + 1);
  end;
  glEnd;
end;

3d-terrain-programming's People

Contributors

jseling avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.