VoxelEngine/Objects/Objects.py
2020-07-25 15:03:05 +02:00

40 lines
853 B
Python

import numpy as np
import typing
class Object:
GeometryShaderId = -1
def draw(self) -> bool:
return False
@classmethod
def initializeShader(cls) -> bool:
return True
def __init__(self):
self.pos = np.zeros(3)
self.color = np.zeros((3,))
self.programmId = -1
def translate(self, M):
self.pos = np.array((np.concatenate((self.pos, [1])) * M)[0, 0:3])[0]
return self
def setColor(self, R, G, B):
self.color[0] = R
self.color[1] = G
self.color[2] = B
return self
class SizedObject(Object):
def __init__(self):
super(SizedObject, self).__init__()
self.size = np.array((0.5, 0.5, 0.5))
def setSize(self, X, Y, Z):
self.size[0] = X
self.size[1] = Y
self.size[2] = Z
return self