mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Fixed scaling lighting weirdness
This commit is contained in:
@@ -2,13 +2,18 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
glu (8.3.0)
|
glu (8.3.0)
|
||||||
|
glu (8.3.0-x86-mingw32)
|
||||||
glut (8.3.0)
|
glut (8.3.0)
|
||||||
gosu (0.13.1)
|
glut (8.3.0-x86-mingw32)
|
||||||
|
gosu (0.13.2)
|
||||||
|
gosu (0.13.2-x86-mingw32)
|
||||||
opengl (0.10.0)
|
opengl (0.10.0)
|
||||||
|
opengl (0.10.0-x86-mingw32)
|
||||||
wavefront (0.1.2)
|
wavefront (0.1.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
x86-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
glu
|
glu
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ require "glu"
|
|||||||
require "glut"
|
require "glut"
|
||||||
require "gosu"
|
require "gosu"
|
||||||
require "fiddle"
|
require "fiddle"
|
||||||
# require "wavefront"
|
|
||||||
|
|
||||||
require_relative "lib/wavefront/model"
|
require_relative "lib/wavefront/model"
|
||||||
require_relative "lib/wavefront/object"
|
require_relative "lib/wavefront/object"
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ class IMICFPS
|
|||||||
|
|
||||||
def render(x,y,z, scale = 1)
|
def render(x,y,z, scale = 1)
|
||||||
glTranslatef(x,y,z)
|
glTranslatef(x,y,z)
|
||||||
glScalef(scale,scale,scale)
|
|
||||||
@objects.each_with_index do |o, i|
|
@objects.each_with_index do |o, i|
|
||||||
glEnable(GL_CULL_FACE)
|
glEnable(GL_CULL_FACE)
|
||||||
glEnable(GL_COLOR_MATERIAL)
|
glEnable(GL_COLOR_MATERIAL)
|
||||||
@@ -63,8 +62,8 @@ class IMICFPS
|
|||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, [material.diffuse.red, material.diffuse.green, material.diffuse.blue, 1.0])
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, [material.diffuse.red, material.diffuse.green, material.diffuse.blue, 1.0])
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [material.specular.red, material.specular.green, material.specular.blue, 1.0])
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [material.specular.red, material.specular.green, material.specular.blue, 1.0])
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, [10.0])
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, [10.0])
|
||||||
glNormal3f(normal.x, normal.y, normal.z)
|
glNormal3f(normal.x, normal.y, normal.z) # Don't scale normals
|
||||||
glVertex3f(vertex.x, vertex.y, vertex.z)
|
glVertex3f(vertex.x*scale, vertex.y*scale, vertex.z*scale)
|
||||||
end
|
end
|
||||||
glEnd
|
glEnd
|
||||||
glDisable(GL_CULL_FACE)
|
glDisable(GL_CULL_FACE)
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class IMICFPS
|
|||||||
gluLookAt(@camera.x,@camera.y,@camera.z, @angle_x,@angle_y,0, 0,1,0)
|
gluLookAt(@camera.x,@camera.y,@camera.z, @angle_x,@angle_y,0, 0,1,0)
|
||||||
|
|
||||||
color = [@c1, @c2, @c3]
|
color = [@c1, @c2, @c3]
|
||||||
@model.draw(0, 0, 0, 0.005)
|
@model.draw(0, 0, 0, 0.0009)
|
||||||
@model2.draw(5, 0, 0, 0.005)
|
@model2.draw(5, 0, 0, 0.0009)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -98,8 +98,8 @@ class IMICFPS
|
|||||||
@angle_y = @angle_y.clamp(-360, 360)
|
@angle_y = @angle_y.clamp(-360, 360)
|
||||||
self.mouse_x, self.mouse_y = Gosu.screen_width/2, Gosu.screen_height/2
|
self.mouse_x, self.mouse_y = Gosu.screen_width/2, Gosu.screen_height/2
|
||||||
|
|
||||||
@light_postion = [@camera.x, @camera.y, @camera.z, 1]
|
@light_postion = [@camera.x, @camera.y, @camera.z, 0]
|
||||||
# @light_postion = [1.0, 0.249, 4.09, 1]
|
# @light_postion = [0.0, 10, 0, 0]
|
||||||
|
|
||||||
@camera.x-=@speed if $window.button_down?(Gosu::KbRight)
|
@camera.x-=@speed if $window.button_down?(Gosu::KbRight)
|
||||||
@camera.x+=@speed if $window.button_down?(Gosu::KbLeft)
|
@camera.x+=@speed if $window.button_down?(Gosu::KbLeft)
|
||||||
|
|||||||
Reference in New Issue
Block a user