-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock.py
26 lines (20 loc) · 1.04 KB
/
block.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import models, collider
class BlockType:
def __init__(self, textureManager, name, model, textures, isBlock = None, isTransparent = None, isGlass = None):
self.name = name
self.textures = textures
self.model = model
self.isBlock = model.isBlock if isBlock is None else isBlock
self.isTransparent = model.isTransparent if isTransparent is None else isTransparent
self.isGlass = model.isGlass if isGlass is None else isGlass
self.colliders = []
for _collider in model.colliders:
self.colliders.append(collider.Collider(*_collider))
self.vertexPositions = self.model.vertexPositions
self.texCoords = self.model.texCoords.copy()
self.shadingValues = self.model.shadingValues
for index, texture in enumerate(self.textures):
textureIndex = textureManager.addTexture(texture)
self.texCoords[index] = self.texCoords[index].copy()
for vertex in range(4):
self.texCoords[index][vertex * 3 + 2] = textureIndex