Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion renpy/display/accelerator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def transform_render(self, widtho, heighto, st, at):

if mesh:


mr = Render(cr.width, cr.height)

mesh_pad = state.mesh_pad
Expand Down
4 changes: 2 additions & 2 deletions renpy/display/render.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ cdef class Render:

cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):
"""
Blits `source` (a Render, Surface, or Model) to this Render, offset by
Blits `source` (a Render, Surface, or GL2Model) to this Render, offset by
xo and yo.

If `focus` is true, then focuses are added from the child to the
Expand Down Expand Up @@ -771,7 +771,7 @@ cdef class Render:

cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):
"""
Blits `source` (a Render, Surface, or Model) to this Render, offset by
Blits `source` (a Render, Surface, or GL2Model) to this Render, offset by
xo and yo.

If `focus` is true, then focuses are added from the child to the
Expand Down
14 changes: 7 additions & 7 deletions renpy/gl2/gl2draw.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cimport renpy.gl2.gl2texture as gl2texture
from renpy.gl2.gl2mesh cimport Mesh
from renpy.gl2.gl2mesh3 cimport Mesh3
from renpy.gl2.gl2polygon cimport Polygon
from renpy.gl2.gl2model cimport Model
from renpy.gl2.gl2model cimport GL2Model

from renpy.gl2.gl2texture import Texture, TextureLoader
from renpy.gl2.gl2shadercache import ShaderCache
Expand Down Expand Up @@ -756,7 +756,7 @@ cdef class GL2Draw:

color = (r, g, b, a)

return Model((w, h), mesh, ("renpy.solid", ), { "u_renpy_solid_color" : color })
return GL2Model((w, h), mesh, ("renpy.solid", ), { "u_renpy_solid_color" : color })

def flip(self):
"""
Expand Down Expand Up @@ -855,7 +855,7 @@ cdef class GL2Draw:
self.load_all_textures(what)
return

if isinstance(what, Model):
if isinstance(what, GL2Model):
what.load()
return

Expand All @@ -872,7 +872,7 @@ cdef class GL2Draw:
for i in r.children:
self.load_all_textures(i[0])

# If we have a mesh (or mesh=True), create the Model.
# If we have a mesh (or mesh=True), create the GL2Model.
if r.mesh:

if (r.mesh is True) and (not r.children):
Expand All @@ -890,7 +890,7 @@ cdef class GL2Draw:
else:
mesh = r.mesh

r.cached_model = Model(
r.cached_model = GL2Model(
(r.width, r.height),
mesh,
r.shaders,
Expand Down Expand Up @@ -1213,7 +1213,7 @@ cdef class GL2DrawingContext:
def draw_one(self, what, Matrix transform, Polygon clip_polygon, tuple shaders, dict uniforms, dict properties):
"""
This is responsible for walking the surface tree, and drawing any
Models, Renders, and Surfaces it encounters.
GL2Models, Renders, and Surfaces it encounters.

`transform`
The matrix that transforms texture space into drawable space.
Expand All @@ -1239,7 +1239,7 @@ cdef class GL2DrawingContext:
if isinstance(what, Surface):
what = self.gl2draw.load_texture(what)

if isinstance(what, Model):
if isinstance(what, GL2Model):
self.draw_model(what, transform, clip_polygon, shaders, uniforms, properties)
return

Expand Down
2 changes: 1 addition & 1 deletion renpy/gl2/gl2mesh.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cdef class AttributeLayout:
cdef class Mesh:
"""
This represents the polygon and vertex data that is stored within
a Model.
a GL2Model.
"""

# The number of points that space has been allocated for.
Expand Down
8 changes: 4 additions & 4 deletions renpy/gl2/gl2model.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from renpy.display.matrix cimport Matrix
from renpy.gl2.gl2mesh cimport Mesh

cdef class Model:
cdef class GL2Model:

# The width and height.
cdef public int width
Expand Down Expand Up @@ -31,6 +31,6 @@ cdef class Model:
# a Texture.)
cdef object cached_texture

cpdef Model copy(Model self)
cpdef subsurface(Model self, t)
cpdef scale(Model self, float factor)
cpdef GL2Model copy(GL2Model self)
cpdef subsurface(GL2Model self, t)
cpdef scale(GL2Model self, float factor)
22 changes: 11 additions & 11 deletions renpy/gl2/gl2model.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ from renpy.gl2.gl2texture cimport GLTexture

from libc.math cimport ceil

cdef class Model:
cdef class GL2Model:
"""
A model can be placed as a leaf of the tree of Renders, and contains
everything needed to be draw to the screen.
"""

def __init__(Model self, size, mesh, shaders, uniforms):
def __init__(GL2Model self, size, mesh, shaders, uniforms):
self.width = size[0]
self.height = size[1]
self.mesh = mesh
Expand All @@ -23,7 +23,7 @@ cdef class Model:
self.forward = IDENTITY
self.reverse = IDENTITY

def __repr__(Model self):
def __repr__(GL2Model self):
rv = "<{} {}x{} {} {}".format(type(self).__name__, self.width, self.height, self.shaders, self.uniforms)

if self.forward is not IDENTITY:
Expand Down Expand Up @@ -54,33 +54,33 @@ cdef class Model:

def get_size(self):
"""
Returns the size of this Model.
Returns the size of this GL2Model.
"""

return (self.width, self.height)

cpdef Model copy(Model self):
cpdef GL2Model copy(GL2Model self):
"""
Creates an identical copy of the current model.
"""

cdef Model rv = Model((self.width, self.height), self.mesh, self.shaders, self.uniforms)
cdef GL2Model rv = GL2Model((self.width, self.height), self.mesh, self.shaders, self.uniforms)
rv.forward = self.forward
rv.reverse = self.reverse

return rv

cpdef subsurface(Model self, rect):
cpdef subsurface(GL2Model self, rect):
"""
Given a rectangle `rect`, returns a Model that only contains the
Given a rectangle `rect`, returns a GL2Model that only contains the
portion of the model inside the rectangle.
"""

cdef float x, y, w, h

x, y, w, h = rect

cdef Model rv = self.copy()
cdef GL2Model rv = self.copy()

rv.width = <int> ceil(w)
rv.height = <int> ceil(h)
Expand All @@ -95,14 +95,14 @@ cdef class Model:

return rv

cpdef scale(Model self, float factor):
cpdef scale(GL2Model self, float factor):
"""
Creates a new model that is this model scaled by a constant factor.
"""

cdef float reciprocal_factor

cdef Model rv = self.copy()
cdef GL2Model rv = self.copy()

rv.width = <int> ceil(rv.width * factor)
rv.height = <int> ceil(rv.height * factor)
Expand Down
4 changes: 2 additions & 2 deletions renpy/gl2/gl2texture.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from renpy.uguu.gl cimport *
from renpy.gl2.gl2shader cimport Program
from renpy.gl2.gl2model cimport Model
from renpy.gl2.gl2model cimport GL2Model
from renpy.gl2.gl2draw cimport GL2Draw

cdef class TextureLoader:
Expand Down Expand Up @@ -52,7 +52,7 @@ cdef class TextureLoader:
cdef GLfloat max_anisotropy


cdef class GLTexture(Model):
cdef class GLTexture(GL2Model):

# The number of the texture in OpenGL.
cdef public unsigned int number
Expand Down
10 changes: 5 additions & 5 deletions renpy/gl2/gl2texture.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ from renpy.gl2.gl2draw cimport GL2Draw

from renpy.gl2.gl2mesh cimport Mesh
from renpy.gl2.gl2mesh2 cimport Mesh2
from renpy.gl2.gl2model cimport Model
from renpy.gl2.gl2model cimport GL2Model

from renpy.display.matrix cimport Matrix

Expand Down Expand Up @@ -127,7 +127,7 @@ cdef class TextureLoader:
0.0, 0.0, pw, ph,
0.0, 0.0, 0.0, 0.0)

rv = Model((pw, ph), mesh, ("renpy.texture",), { "tex0" : rv })
rv = GL2Model((pw, ph), mesh, ("renpy.texture",), { "tex0" : rv })

return rv

Expand Down Expand Up @@ -243,7 +243,7 @@ cdef class TextureLoader:

return False

cdef class GLTexture(Model):
cdef class GLTexture(GL2Model):
"""
This class represents an OpenGL texture that needs to be loaded by
Ren'Py. It's responsible for handling deferred loading of textures,
Expand All @@ -259,7 +259,7 @@ cdef class GLTexture(Model):

width, height = size

Model.__init__(self, size, None, ("renpy.texture",), None)
GL2Model.__init__(self, size, None, ("renpy.texture",), None)

# The number of the OpenGL texture this texture object
# represents.
Expand Down Expand Up @@ -525,7 +525,7 @@ cdef class GLTexture(Model):
shader.set_uniform("tex0", self)

cpdef subsurface(self, rect):
rv = Model.subsurface(self, rect)
rv = GL2Model.subsurface(self, rect)
if rv is not self:
rv.uniforms = { "tex0" : self }
return rv
Expand Down