mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
30 lines
665 B
Ruby
30 lines
665 B
Ruby
class IMICFPS
|
|
class Terrain
|
|
include OpenGL
|
|
def initialize(size:, heightmap: nil)
|
|
@size = size.to_f
|
|
@heightmap = heightmap
|
|
end
|
|
|
|
def draw
|
|
height = 0
|
|
glEnable(GL_COLOR_MATERIAL)
|
|
|
|
glBegin(GL_TRIANGLES)
|
|
glNormal3f(0,1,0)
|
|
glColor3f(1, 0.5, 0.0)
|
|
glVertex3f(-@size/2,height,-@size/2)
|
|
glVertex3f(-@size/2,height,@size/2)
|
|
glVertex3f(@size/2,height,@size/2)
|
|
|
|
glColor3f(0, 0.5, 0.0)
|
|
glVertex3f(@size/2,height,@size/2)
|
|
glVertex3f(@size/2,height,-@size/2)
|
|
glVertex3f(-@size/2,height,-@size/2)
|
|
glEnd
|
|
|
|
glDisable(GL_COLOR_MATERIAL)
|
|
end
|
|
end
|
|
end
|