mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
More testing
This commit is contained in:
@@ -2,7 +2,7 @@ class IMICFPS
|
||||
class Terrain
|
||||
include OpenGL
|
||||
def initialize(size:, height: nil, width: nil, length: nil, heightmap: nil)
|
||||
@size = size
|
||||
@size = 3#size
|
||||
@heightmap = heightmap
|
||||
@map = []
|
||||
|
||||
@@ -23,6 +23,8 @@ class IMICFPS
|
||||
@length.times do |z|
|
||||
@map << Vertex.new(x-@width.to_f/2, @height, z-@length.to_f/2)
|
||||
@map << Vertex.new(x+1-@width.to_f/2, @height, z-@length.to_f/2)
|
||||
@map << Vertex.new(x-@width.to_f/2, @height, z+1-@length.to_f/2)
|
||||
|
||||
# @map << Vertex.new(x+1, height, z)
|
||||
# @map << Vertex.new(x+1, height, z-1)
|
||||
#
|
||||
@@ -32,6 +34,7 @@ class IMICFPS
|
||||
# height +=0.5
|
||||
end
|
||||
|
||||
|
||||
# @map << row
|
||||
end
|
||||
|
||||
@@ -55,22 +58,22 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def draw
|
||||
new_draw
|
||||
# new_draw
|
||||
old_draw
|
||||
end
|
||||
|
||||
def old_draw
|
||||
glEnable(GL_COLOR_MATERIAL)
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
||||
# glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
||||
glPointSize(5)
|
||||
# glBegin(GL_LINES)
|
||||
# glBegin(GL_POINTS)
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glBegin(GL_TRIANGLES)
|
||||
@map.each_with_index do |vertex, index|
|
||||
glNormal3f(0,1,0)
|
||||
glColor3f(0.0, 0.5, 0) if index.even?
|
||||
glColor3f(0.5, 0, 0) if index.odd?
|
||||
glColor3f(0, 1.0, 0) if index.odd?
|
||||
glVertex3f(vertex.x, vertex.y, vertex.z)
|
||||
end
|
||||
glEnd
|
||||
|
||||
@@ -21,13 +21,15 @@ class IMICFPS
|
||||
@draw_skydome = true
|
||||
@skydome = Skydome.new(scale: 0.02, backface_culling: false, auto_manage: false)
|
||||
Tree.new(x: 1, y: 0, z: -5)
|
||||
Tree.new(x: 5, y: 0, z: 5)
|
||||
Tree.new(x: -5, y: 0, z: 1)
|
||||
p ObjectManager.objects.map {|o| o.name}
|
||||
# Model.new(type: :obj, file_path: "objects/tree.obj", z: -5)
|
||||
# Model.new(type: :obj, file_path: "objects/tree.obj", x: -2, z: -6)
|
||||
# Model.new(type: :obj, file_path: "objects/sponza.obj", scale: 1, y: -0.2)
|
||||
@terrain = Terrain.new(size: 20, height: 0)
|
||||
|
||||
@player = Player.new(x: 1, y: 0, z: -10)
|
||||
@player = Player.new(x: 1, y: 0, z: -1)
|
||||
@camera = Camera.new(x: 0, y: -2, z: 1)
|
||||
@camera.attach_to(@player)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user