add renderer z offset
This commit is contained in:
parent
46256e63df
commit
3992ccd552
4 changed files with 10 additions and 6 deletions
|
@ -29,11 +29,13 @@ class RenderEngine(ABC):
|
|||
filetype = 'dat'
|
||||
|
||||
# draw an svg image. supports pseudo-3D shadow-rendering
|
||||
def __init__(self, width: int, height: int, xoff=0, yoff=0, scale=1, buffer=0, background='#FFFFFF', center=True):
|
||||
def __init__(self, width: int, height: int, xoff=0, yoff=0, zoff=0,
|
||||
scale=1, buffer=0, background='#FFFFFF', center=True):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.minx = xoff
|
||||
self.miny = yoff
|
||||
self.base_z = zoff
|
||||
self.scale = scale
|
||||
self.orig_buffer = buffer
|
||||
self.buffer = int(math.ceil(buffer*self.scale))
|
||||
|
|
|
@ -153,10 +153,10 @@ class OpenGLEngine(Base3DEngine):
|
|||
|
||||
scale_x = self.scale / self.width * 2
|
||||
scale_y = self.scale / self.height * 2
|
||||
scale_z = (scale_x+scale_y) / 2
|
||||
scale_z = 0.05
|
||||
|
||||
self.gl_scale = (scale_x, -scale_y, scale_z)
|
||||
self.gl_offset = (-self.minx * scale_x - 1, self.maxy * scale_y - 1, 0)
|
||||
self.gl_offset = (-self.minx * scale_x - 1, self.maxy * scale_y - 1, -self.base_z * scale_z)
|
||||
|
||||
self.vertices = []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue