Added Asset Viewer

This commit is contained in:
2020-01-30 15:30:58 -06:00
parent dbf4edbb93
commit eb1bfe204b
10 changed files with 197 additions and 20 deletions

View File

@@ -111,26 +111,29 @@ class IMICFPS
def free_move
relative_y_rotation = (@orientation.y + 180)
relative_speed = 0.25
relative_speed = 2.5
relative_speed = 1.5 if InputMapper.down?(:sneak)
relative_speed = 10.0 if InputMapper.down?(:sprint)
relative_speed *= window.dt
if InputMapper.down?( :forward)
@position.z+=Math.cos(relative_y_rotation * Math::PI / 180)*relative_speed
@position.x-=Math.sin(relative_y_rotation * Math::PI / 180)*relative_speed
@position.z+=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed
@position.x-=Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed
end
if InputMapper.down?(:backward)
@position.z-=Math.cos(relative_y_rotation * Math::PI / 180)*relative_speed
@position.x+=Math.sin(relative_y_rotation * Math::PI / 180)*relative_speed
@position.z-=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed
@position.x+=Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed
end
if InputMapper.down?(:strife_left)
@position.z+=Math.sin(relative_y_rotation * Math::PI / 180)*relative_speed
@position.x+=Math.cos(relative_y_rotation * Math::PI / 180)*relative_speed
@position.z+=Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed
@position.x+=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed
end
if InputMapper.down?(:strife_right)
@position.z-=Math.sin(relative_y_rotation * Math::PI / 180)*relative_speed
@position.x-=Math.cos(relative_y_rotation * Math::PI / 180)*relative_speed
@position.z-=Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed
@position.x-=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed
end
if InputMapper.down?(:ascend)

View File

@@ -11,13 +11,24 @@ class IMICFPS
def initialize(manifest:, map_entity: nil, spawnpoint: nil, backface_culling: true, auto_manage: true)
@manifest = manifest
@position = map_entity ? map_entity.position.clone : spawnpoint.position.clone
@orientation = map_entity ? map_entity.orientation.clone : spawnpoint.orientation.clone
@scale = map_entity ? map_entity.scale.clone : Vector.new(1, 1, 1)
if map_entity
@position = map_entity.position.clone
@orientation = map_entity.orientation.clone
@scale = map_entity.scale.clone
@bound_model = bind_model
elsif spawnpoint
@position = spawnpoint.position.clone
@orientation = spawnpoint.orientation.clone
@scale = Vector.new(1, 1, 1)
else
@position = Vector.new
@orientation = Vector.up
@scale = Vector.new(1, 1, 1)
end
@backface_culling = backface_culling
@name = @manifest.name
@bound_model = map_entity ? bind_model : nil
@visible = true
@renderable = true
@@ -57,7 +68,7 @@ class IMICFPS
end
def bind_model
model = ModelCache.new(manifest: @manifest, entity: @dummy_entity)
model = ModelCache.new(manifest: @manifest)
raise "model isn't a model!" unless model.is_a?(ModelCache)
@bound_model = model