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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# Patch for compatibility with new, Arch's default version of numpy
--- renderer.py.orig 2015-08-12 07:12:26.000000000 -0600
+++ renderer.py 2015-12-24 19:47:05.717201498 -0700
@@ -227,6 +227,12 @@
from config import config
# import time
+def numpy17_combine_colors(target, colors):
+ """ Combines colors without upseting new version of numpy """
+ target = numpy.array(target, "f")
+ target *= colors
+ target = numpy.array(target, "uint8")
+ return target
def chunkMarkers(chunkSet):
""" Returns a mapping { size: [position, ...] } for different powers of 2
@@ -1570,7 +1576,7 @@
va1[_XYZ][:, :, 0] *= step
va1[_XYZ][:, :, 2] *= step
- flatcolors *= 0.8
+ flatcolors = flatcolors * 0.8
va1.view('uint8')[_RGBA] = flatcolors
grassmask = topBlocks[nonAirBlocks] == 2
@@ -1617,7 +1623,8 @@
if self.materials.name in ("Alpha", "Pocket"):
if direction == pymclevel.faces.FaceYIncreasing:
grass = theseBlocks == pymclevel.materials.alphaMaterials.Grass.ID
- vertexArray.view('uint8')[_RGB][grass] *= self.grassColor
+ vertexArray.view('uint8')[_RGB][grass] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][grass], self.grassColor)
yield
vertexArrays.append(vertexArray)
@@ -1688,12 +1695,18 @@
vertexArray.view('uint8')[_RGB] *= facingBlockLight[blockIndices][..., numpy.newaxis, numpy.newaxis]
if self.materials.name in ("Alpha", "Pocket"):
- vertexArray.view('uint8')[_RGB][leaves] *= self.leafColor
- vertexArray.view('uint8')[_RGB][pines] *= self.pineLeafColor
- vertexArray.view('uint8')[_RGB][birches] *= self.birchLeafColor
- vertexArray.view('uint8')[_RGB][jungle] *= self.jungleLeafColor
- vertexArray.view('uint8')[_RGB][acacia] *= self.acaciaLeafColor
- vertexArray.view('uint8')[_RGB][darkoak] *= self.darkoakLeafColor
+ vertexArray.view('uint8')[_RGB][leaves] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][leaves], self.leafColor)
+ vertexArray.view('uint8')[_RGB][pines] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][pines], self.pineLeafColor)
+ vertexArray.view('uint8')[_RGB][birches] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][birches], self.birchLeafColor)
+ vertexArray.view('uint8')[_RGB][jungle] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][jungle], self.jungleLeafColor)
+ vertexArray.view('uint8')[_RGB][acacia] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][acacia], self.acaciaLeafColor)
+ vertexArray.view('uint8')[_RGB][darkoak] = \
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][darkoak], self.darkoakLeafColor)
yield
arrays.append(vertexArray)
@@ -1762,8 +1775,8 @@
vertexArray.view('uint8')[_RGB] = 0xf # ignore precomputed directional light
vertexArray.view('uint8')[_RGB] *= lights
if colorize is not None:
- vertexArray.view('uint8')[_RGB][colorize] *= LeafBlockRenderer.leafColor
- vertexArray.view('uint8')[_RGB][colorize2] *= LeafBlockRenderer.leafColor
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][colorize], LeafBlockRenderer.leafColor)
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB][colorize2], LeafBlockRenderer.leafColor)
arrays.append(vertexArray)
yield
@@ -1994,7 +2007,8 @@
tex = texMap(railBlocks, bdata, pymclevel.faces.FaceYIncreasing)[:, numpy.newaxis, :]
# disable 'powered' or 'pressed' bit for powered and detector rails
- bdata[railBlocks != pymclevel.materials.alphaMaterials.Rail.ID] &= ~0x8
+ bdata[railBlocks != pymclevel.materials.alphaMaterials.Rail.ID] = \
+ numpy.uint8(bdata[railBlocks != pymclevel.materials.alphaMaterials.Rail.ID] & ~0x8)
vertexArray = self.makeTemplate(direction, blockIndices)
if not len(vertexArray):
@@ -2853,7 +2867,7 @@
lights = blockLight[blockIndices][..., numpy.newaxis, numpy.newaxis]
vertexArray.view('uint8')[_RGB] *= lights
- vertexArray.view('uint8')[_RGB] *= LeafBlockRenderer.leafColor
+ numpy17_combine_colors(vertexArray.view('uint8')[_RGB], LeafBlockRenderer.leafColor)
if direction == pymclevel.faces.FaceZIncreasing:
vertexArray[_XYZ][..., 2] -= 0.0625
--- viewports/camera.py.orig 2015-08-12 07:12:26.000000000 -0600
+++ viewports/camera.py 2015-12-24 18:32:08.063734146 -0700
@@ -261,7 +261,7 @@
def setModelview(self):
pos = self.cameraPosition
- look = numpy.array(self.cameraPosition)
- look += self.cameraVector
+ look = numpy.array(self.cameraPosition, dtype='f')
+ look = look + self.cameraVector
up = (0, 1, 0)
GLU.gluLookAt(pos[0], pos[1], pos[2],
--- editortools/player.py.orig 2015-08-12 07:12:26.000000000 -0600
+++ editortools/player.py 2015-12-24 19:17:01.763814413 -0700
@@ -1025,7 +1025,7 @@
pixelScale = 0.5 if self.editor.level.materials.name in ("Pocket", "Alpha") else 1.0
texSize = 16 * pixelScale
- cageTexVerts *= pixelScale
+ cageTexVerts = cageTexVerts * pixelScale
cageTexVerts = numpy.array(
[((tx, ty), (tx + texSize, ty), (tx + texSize, ty + texSize), (tx, ty + texSize)) for (tx, ty) in
|