mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Added Alternate Tank, go back to using glScalef for scaling models until shader based rendering is implemented, improved Map handling of scaling.
This commit is contained in:
2
assets/base/alternate_tank/manifest.yaml
Normal file
2
assets/base/alternate_tank/manifest.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
name: "Alternate Tank"
|
||||||
|
model: "alternate_tank.obj"
|
||||||
42
assets/base/alternate_tank/model/alternate_tank.mtl
Normal file
42
assets/base/alternate_tank/model/alternate_tank.mtl
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Blender MTL File: 'alternate_tank.blend'
|
||||||
|
# Material Count: 4
|
||||||
|
|
||||||
|
newmtl Body
|
||||||
|
Ns 110.250015
|
||||||
|
Ka 0.900000 0.900000 0.900000
|
||||||
|
Kd 0.029064 0.018578 0.011797
|
||||||
|
Ks 0.883333 0.883333 0.883333
|
||||||
|
Ke 0.0 0.0 0.0
|
||||||
|
Ni 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 3
|
||||||
|
|
||||||
|
newmtl Material
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.527719 0.213857 0.101860
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.0 0.0 0.0
|
||||||
|
Ni 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
|
||||||
|
newmtl Material.001
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.029064 0.018578 0.011797
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.0 0.0 0.0
|
||||||
|
Ni 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
|
||||||
|
newmtl wheel
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.044455 0.044455 0.044455
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.0 0.0 0.0
|
||||||
|
Ni 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
2457
assets/base/alternate_tank/model/alternate_tank.obj
Normal file
2457
assets/base/alternate_tank/model/alternate_tank.obj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,3 +2,10 @@ name: "power_plant"
|
|||||||
model: "power_plant.obj"
|
model: "power_plant.obj"
|
||||||
collision: "mesh"
|
collision: "mesh"
|
||||||
collision_mesh: null # Use model mesh for collision detection
|
collision_mesh: null # Use model mesh for collision detection
|
||||||
|
uses:
|
||||||
|
-
|
||||||
|
package: "base"
|
||||||
|
model: "purchase_terminal"
|
||||||
|
-
|
||||||
|
package: "base"
|
||||||
|
model: "information_panel"
|
||||||
BIN
blends/alternate_tank.blend
Normal file
BIN
blends/alternate_tank.blend
Normal file
Binary file not shown.
BIN
blends/alternate_tank.blend1
Normal file
BIN
blends/alternate_tank.blend1
Normal file
Binary file not shown.
@@ -9,11 +9,11 @@ class IMICFPS
|
|||||||
attr_accessor :position, :orientation, :velocity
|
attr_accessor :position, :orientation, :velocity
|
||||||
attr_reader :name, :debug_color, :bounding_box, :collision, :physics, :mass, :drag, :camera
|
attr_reader :name, :debug_color, :bounding_box, :collision, :physics, :mass, :drag, :camera
|
||||||
|
|
||||||
def initialize(manifest:, map_entity: nil, spawnpoint: nil, backface_culling: false, auto_manage: true)
|
def initialize(manifest:, map_entity: nil, spawnpoint: nil, backface_culling: true, auto_manage: true)
|
||||||
@manifest = manifest
|
@manifest = manifest
|
||||||
@position = map_entity ? map_entity.position.clone : spawnpoint.position.clone
|
@position = map_entity ? map_entity.position.clone : spawnpoint.position.clone
|
||||||
@orientation = map_entity ? map_entity.orientation.clone : spawnpoint.orientation.clone
|
@orientation = map_entity ? map_entity.orientation.clone : spawnpoint.orientation.clone
|
||||||
@scale = map_entity ? map_entity.scale : 1.0
|
@scale = map_entity ? map_entity.scale.clone : Vector.new(1, 1, 1)
|
||||||
|
|
||||||
@backface_culling = backface_culling
|
@backface_culling = backface_culling
|
||||||
@name = @manifest.name
|
@name = @manifest.name
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ class IMICFPS
|
|||||||
manifest_file = "#{IMICFPS.assets_path}/#{package}/#{model}/manifest.yaml"
|
manifest_file = "#{IMICFPS.assets_path}/#{package}/#{model}/manifest.yaml"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
raise "No manifest found at: #{manifest_file}" unless File.exist?(manifest_file)
|
||||||
|
|
||||||
@file = manifest_file
|
@file = manifest_file
|
||||||
parse(manifest_file)
|
parse(manifest_file)
|
||||||
end
|
end
|
||||||
|
|||||||
41
lib/map.rb
41
lib/map.rb
@@ -34,7 +34,20 @@ class IMICFPS
|
|||||||
@terrain.model = section["model"]
|
@terrain.model = section["model"]
|
||||||
@terrain.position = Vector.new
|
@terrain.position = Vector.new
|
||||||
@terrain.orientation = Vector.new
|
@terrain.orientation = Vector.new
|
||||||
@terrain.scale = 1.0
|
if section["scale"]
|
||||||
|
if section["scale"].is_a?(Hash)
|
||||||
|
@terrain.scale = Vector.new(
|
||||||
|
section["scale"]["x"],
|
||||||
|
section["scale"]["y"],
|
||||||
|
section["scale"]["z"]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
scale = Float(section["scale"])
|
||||||
|
@terrain.scale = Vector.new(scale, scale, scale)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@terrain.scale = Vector.new(1, 1, 1)
|
||||||
|
end
|
||||||
@terrain.water_level = section["water_level"]
|
@terrain.water_level = section["water_level"]
|
||||||
else
|
else
|
||||||
raise "Map terrain data is missing!"
|
raise "Map terrain data is missing!"
|
||||||
@@ -45,7 +58,20 @@ class IMICFPS
|
|||||||
@skydome.model = section["model"]
|
@skydome.model = section["model"]
|
||||||
@skydome.position = Vector.new
|
@skydome.position = Vector.new
|
||||||
@skydome.orientation = Vector.new
|
@skydome.orientation = Vector.new
|
||||||
@skydome.scale = section["scale"] ? section["scale"] : 1.0
|
if section["scale"]
|
||||||
|
if section["scale"].is_a?(Hash)
|
||||||
|
@skydome.scale = Vector.new(
|
||||||
|
section["scale"]["x"],
|
||||||
|
section["scale"]["y"],
|
||||||
|
section["scale"]["z"]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
scale = Float(section["scale"])
|
||||||
|
@skydome.scale = Vector.new(scale, scale, scale)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@skydome.scale = Vector.new(1, 1, 1)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
raise "Map skydome data is missing!"
|
raise "Map skydome data is missing!"
|
||||||
end
|
end
|
||||||
@@ -65,7 +91,16 @@ class IMICFPS
|
|||||||
ent["orientation"]["y"],
|
ent["orientation"]["y"],
|
||||||
ent["orientation"]["z"]
|
ent["orientation"]["z"]
|
||||||
)
|
)
|
||||||
entity.scale = ent["scale"]
|
if ent["scale"].is_a?(Hash)
|
||||||
|
entity.scale = Vector.new(
|
||||||
|
ent["scale"]["x"],
|
||||||
|
ent["scale"]["y"],
|
||||||
|
ent["scale"]["z"]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
scale = Float(ent["scale"])
|
||||||
|
entity.scale = Vector.new(scale, scale, scale)
|
||||||
|
end
|
||||||
entity.scripts = ent["scripts"]
|
entity.scripts = ent["scripts"]
|
||||||
|
|
||||||
@entities << entity
|
@entities << entity
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class IMICFPS
|
|||||||
glPushMatrix
|
glPushMatrix
|
||||||
|
|
||||||
glTranslatef(object.position.x, object.position.y, object.position.z)
|
glTranslatef(object.position.x, object.position.y, object.position.z)
|
||||||
|
glScalef(object.scale.x, object.scale.y, object.scale.z)
|
||||||
glRotatef(object.orientation.x, 1.0, 0, 0)
|
glRotatef(object.orientation.x, 1.0, 0, 0)
|
||||||
glRotatef(object.orientation.y, 0, 1.0, 0)
|
glRotatef(object.orientation.y, 0, 1.0, 0)
|
||||||
glRotatef(object.orientation.z, 0, 0, 1.0)
|
glRotatef(object.orientation.z, 0, 0, 1.0)
|
||||||
|
|||||||
@@ -164,6 +164,22 @@
|
|||||||
},
|
},
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"scripts": []
|
"scripts": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package":"base",
|
||||||
|
"model":"alternate_tank",
|
||||||
|
"position": {
|
||||||
|
"x":39.3939,
|
||||||
|
"y":0.799657,
|
||||||
|
"z":20.69697
|
||||||
|
},
|
||||||
|
"orientation": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"scale": 1.0,
|
||||||
|
"scripts": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user