Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Closer and closer >:D

  • Loading branch information...
commit aa84b11772b3537f564d5723045d482851a1f9a2 1 parent 2edd282
@fabianhjr authored
Showing with 25 additions and 16 deletions.
  1. +4 −4 Engine/__main__.py
  2. +6 −6 Engine/loaders/obj.py
  3. +15 −6 Engine/object.py
View
8 Engine/__main__.py
@@ -20,7 +20,7 @@
print "=== Cargando Engine ==="
if path[0].split("/")[-1] == "Engine": chdir("../")
path.append("./")
-import config, object
+import config, object, resourcemanager
from loaders import obj, glsl
##############
@@ -118,7 +118,7 @@ def init():
# Info
print "OpenGL: ", glGetString(GL_VERSION), ", GLSL: ", glGetString(GL_SHADING_LANGUAGE_VERSION)
- # login()
+ login()
# Main Loop
glutFullScreen()
@@ -148,9 +148,9 @@ def display():
glutSolidSphere(100,20, 20)
# GUI
- glRasterPos(pos[0]*2 - 10, pos[1]*2 - 10, pos[2]*2)
+ glRasterPos(pos[0]*2 - 5, pos[1]*2 - 5, pos[2]*2)
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_10, "FPS: " + str(config.fps))
- glRasterPos(pos[0]*2, pos[1]*2, pos[2]*2)
+ glRasterPos(pos[0]*2 + 5, pos[1]*2 + 5, pos[2]*2)
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_10, "Lives: 1")
# Pasar a pantalla
View
12 Engine/loaders/obj.py
@@ -112,12 +112,12 @@ def __init__(self, filename, swapyz=False):
glEnd()
glDisable(GL_TEXTURE_2D)
glEndList()
+
+ # AABB
+ self.aabb = [self.vertices[0], self.vertices[1]]
+ for i in self.vertices:
+ self.aabb = [map(min, zip(i, self.aabb[0])), map(max, zip(i, self.aabb[1]))]
# Funcion Para dibujar
- def draw(self = None):
+ def draw(self):
glCallList(self.gl_list)
-
- def aabb():
- try: self.aabb
- except: self.aabb = [map(min, [i for i in self.vertices]), map(max, [i for i in self.vertices])]
- return self.aabb
View
21 Engine/object.py
@@ -52,7 +52,10 @@ def update(self):
# Pos
self._prop["pos"] = map(sum, zip(self._prop["pos"], [i / config.fps for i in self._prop["vec"]]))
- self._prop["pos"][0] %= 360
+ if self._prop["pos"][0] / 180.0 > 1.0 or self._prop["pos"][0] / 180.0 < 0.0:
+ self._prop["pos"][1] += 180
+ self._prop["pos"][2] += 180
+ self._prop["pos"][0] %= 180
self._prop["pos"][1] %= 360
self._prop["pos"][2] %= 360
self._prop["pos"][3] = abs(self._prop["pos"][3])
@@ -64,9 +67,8 @@ def update(self):
dist = 0
# TODO AAB Physics
- for i in objects:
- pass
-
+ for ob in objects:
+ objects[ob]._prop["pos"]
def force(self, force = [0,0,0,0]):
self._prop["forces"].append([float(i) / self._prop["mass"] for i in force])
@@ -110,7 +112,14 @@ def draw(self):
def fire(self):
create("resources/models/skybox.obj",
{"pos": self._prop["pos"][:3] + [120],
- "vec": [sin(radians(self._prop["pos"][2])) * 100,
- cos(radians(self._prop["pos"][2])) * 100, 0, 0],
+ "vec": [cos(radians(self._prop["pos"][2])) * 100, sin(radians(self._prop["pos"][2])) * 100, 0, 0],
"scale": 0.5,
"class": "bullet"})
+
+ def cyl(self):
+ try: return self._prop["cyl"]
+ except:
+ v1, v2 = resourcemanager.get(self._prop["res"]).aabb
+ v1 = [i * self._prop["scale"] for i in v1]
+ v2 = [i * self._prop["scale"] for i in v1]
+ self._prop["cyl"] = [max(abs(i[0]), abs(i[1])) for i in zip(v1, v2)]
Please sign in to comment.
Something went wrong with that request. Please try again.