mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
Fixed missing spaces, added terrain object, various tweaks trying to get collision detection working correctly; Still isn't...
This commit is contained in:
29
lib/objects/terrain.rb
Normal file
29
lib/objects/terrain.rb
Normal 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
|
||||
Reference in New Issue
Block a user