mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Add a bottom grid with UV coordinates
This commit is contained in:
parent
3a2aa12bc3
commit
1bda724cf2
1 changed files with 25 additions and 0 deletions
|
@ -16,6 +16,9 @@ class BuildVolume(SceneNode):
|
||||||
|
|
||||||
self._material = None
|
self._material = None
|
||||||
|
|
||||||
|
self._grid_mesh = None
|
||||||
|
self._grid_material = None
|
||||||
|
|
||||||
def setWidth(self, width):
|
def setWidth(self, width):
|
||||||
self._width = width
|
self._width = width
|
||||||
|
|
||||||
|
@ -34,8 +37,15 @@ class BuildVolume(SceneNode):
|
||||||
Resources.getPath(Resources.ShadersLocation, 'basic.vert'),
|
Resources.getPath(Resources.ShadersLocation, 'basic.vert'),
|
||||||
Resources.getPath(Resources.ShadersLocation, 'vertexcolor.frag')
|
Resources.getPath(Resources.ShadersLocation, 'vertexcolor.frag')
|
||||||
)
|
)
|
||||||
|
self._grid_material = renderer.createMaterial(
|
||||||
|
Resources.getPath(Resources.ShadersLocation, 'basic.vert'),
|
||||||
|
Resources.getPath(Resources.ShadersLocation, 'grid.frag')
|
||||||
|
)
|
||||||
|
self._grid_material.setUniformValue('u_gridColor0', Color(1.0, 1.0, 1.0, 1.0))
|
||||||
|
self._grid_material.setUniformValue('u_gridColor1', Color(0.0, 0.0, 0.0, 1.0))
|
||||||
|
|
||||||
renderer.queueNode(self, material = self._material, transparent = True)
|
renderer.queueNode(self, material = self._material, transparent = True)
|
||||||
|
renderer.queueNode(self, mesh = self._grid_mesh, material = self._grid_material)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def rebuild(self):
|
def rebuild(self):
|
||||||
|
@ -97,3 +107,18 @@ class BuildVolume(SceneNode):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.setMeshData(mb.getData())
|
self.setMeshData(mb.getData())
|
||||||
|
|
||||||
|
mb = MeshBuilder()
|
||||||
|
mb.addQuad(
|
||||||
|
Vector(minW, minH, maxD),
|
||||||
|
Vector(maxW, minH, maxD),
|
||||||
|
Vector(maxW, minH, minD),
|
||||||
|
Vector(minW, minH, minD)
|
||||||
|
)
|
||||||
|
self._grid_mesh = mb.getData()
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(0, 0.0, 0.0)
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(1, 1.0, 1.0)
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(2, 0.0, 1.0)
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(3, 0.0, 0.0)
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(4, 1.0, 1.0)
|
||||||
|
self._grid_mesh.setVertexUVCoordinates(5, 1.0, 0.0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue