MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
mxvk_wrap.graphics.Model Class Reference

Public Member Functions

None __init__ (self, "App" app, str|Path path, *, str|Path textures="", str|Path texture_directory="", float scale=1.0)
 A loadable 3D model with one-call setup.
None cleanup (self, "App" app)
None close (self)
None shaders (self, "App" app, str|Path vertex, str|Path fragment)

Public Attributes

 native = None
 Explicitly free model GPU resources before closing app.

Protected Attributes

 _app = app
 Load a model and retain its application lifetime.

Detailed Description

Definition at line 154 of file graphics.py.

Constructor & Destructor Documentation

◆ __init__()

None mxvk_wrap.graphics.Model.__init__ ( self,
"App" app,
str | Path path,
* ,
str | Path textures = "",
str | Path texture_directory = "",
float scale = 1.0 )

A loadable 3D model with one-call setup.

Definition at line 157 of file graphics.py.

157 def __init__(self, app: "App", path: str | Path, *, textures: str | Path = "", texture_directory: str | Path = "", scale: float = 1.0) -> None:
158 ## @brief Load a model and retain its application lifetime.
159 self._app = app
160 self.native = None
161 try:
162 self.native = mxvk.AbstractModel()
163 self.native.load(app, str(path), str(textures), str(texture_directory), scale)
164 except Exception:
165 self.native = None
166 _abort_failed_resource(app)
167 raise
168 app.add(self)
169

Member Function Documentation

◆ cleanup()

None mxvk_wrap.graphics.Model.cleanup ( self,
"App" app )

Definition at line 174 of file graphics.py.

174 def cleanup(self, app: "App") -> None:
175 ## @brief Explicitly free model GPU resources before closing @p app.
176 if self.native is not None:
177 self.native.cleanup(app)
178 self.native = None
179

◆ close()

None mxvk_wrap.graphics.Model.close ( self)

Definition at line 180 of file graphics.py.

180 def close(self) -> None:
181 ## @brief Free model GPU resources and drop its native handle.
182 if self.native is not None:
183 self.native.cleanup(self._app)
184 self.native = None
185
186

◆ shaders()

None mxvk_wrap.graphics.Model.shaders ( self,
"App" app,
str | Path vertex,
str | Path fragment )

Definition at line 170 of file graphics.py.

170 def shaders(self, app: "App", vertex: str | Path, fragment: str | Path) -> None:
171 ## @brief Select custom model shaders.
172 self.native.set_shaders(app, str(vertex), str(fragment))
173

Member Data Documentation

◆ _app

mxvk_wrap.graphics.Model._app = app
protected

Load a model and retain its application lifetime.

Free model GPU resources and drop its native handle.

Definition at line 159 of file graphics.py.

◆ native

mxvk_wrap.graphics.Model.native = None

Explicitly free model GPU resources before closing app.

Definition at line 160 of file graphics.py.


The documentation for this class was generated from the following file: