Fixed missing spaces, added terrain object, various tweaks trying to get collision detection working correctly; Still isn't...

This commit is contained in:
2018-03-21 12:09:28 -05:00
parent 2de1c0ffdf
commit e7aa32b62d
8 changed files with 156 additions and 111 deletions

29
lib/objects/terrain.rb Normal file
View File

@@ -0,0 +1,29 @@
class IMICFPS
class Terrain
include OpenGL
def initialize(size:, heightmap: nil)
@size = size
@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,height,-@size)
glVertex3f(-@size,height,@size)
glVertex3f(@size,height,@size)
glColor3f(0, 0.5, 0.0)
glVertex3f(@size,height,@size)
glVertex3f(@size,height,-@size)
glVertex3f(-@size,height,-@size)
glEnd
glDisable(GL_COLOR_MATERIAL)
end
end
end