source: framspy/gui/visual/entity.py @ 1300

Last change on this file since 1300 was 1198, checked in by Maciej Komosinski, 23 months ago

Added simple Python GUI for Framsticks library/server

File size: 1.3 KB
Line 
1import glm
2from gui.visual.modelData import ModelData
3from OpenGL.GL import *
4
5class Entity():
6    def __init__(self, x: float, y: float, z: float, model: ModelData, scale: float = None, rotX: float = None, rotY: float = None, rotZ: float = None, angle: float = None, vector: glm.vec3 = None, color: glm.vec3 = None, rotMatrix: glm.mat4 = None):
7        self.position = glm.vec3(x, y, z)
8        self.rotX = rotX
9        self.rotY = rotY
10        self.rotZ = rotZ
11        self.rotMatrix = rotMatrix
12        self.angle = angle
13        self.vector = vector
14        self.scale = scale
15        self.modelData = model
16        self.textureIndex = 0
17        self.scaleX = None
18        self.scaleY = None
19        self.scaleZ = None
20        self.color = color
21
22    def getTextureXOffset(self):
23        column = self.textureIndex % self.modelData.texture.numberOfRows
24        return column / self.modelData.texture.numberOfRows
25
26    def getTextureYOffset(self):
27        row = self.textureIndex % self.modelData.texture.numberOfRows
28        return row / self.modelData.texture.numberOfRows
29
30    def increasePosition(self, dx: float, dy: float, dz: float):
31        self.position += glm.vec3(dx, dy, dz)
32
33    def increaseRotation(self, dx: float, dy: float, dz: float):
34        self.rotX += dx
35        self.rotY += dy
36        self.rotZ += dz
Note: See TracBrowser for help on using the repository browser.