MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / loadMesh

Method loadMesh

source/MaterialXGraphEditor/RenderView.cpp:254–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254void RenderView::loadMesh(const mx::FilePath& filename)
255{
256 _geometryHandler->clearGeometry();
257 if (_geometryHandler->loadGeometry(filename))
258 {
259 _meshFilename = filename;
260 if (_splitByUdims)
261 {
262 for (auto mesh : _geometryHandler->getMeshes())
263 {
264 mesh->splitByUdims();
265 }
266 }
267
268 updateGeometrySelections();
269
270 // Assign the selected material to all geometries.
271 _materialAssignments.clear();
272 mx::GlslMaterialPtr material = getSelectedMaterial();
273 if (material)
274 {
275 for (mx::MeshPartitionPtr geom : _geometryList)
276 {
277 assignMaterial(geom, material);
278 }
279 }
280
281 // Unbind utility materials from the previous geometry.
282 if (_wireMaterial)
283 {
284 _wireMaterial->unbindGeometry();
285 }
286 if (_shadowMaterial)
287 {
288 _shadowMaterial->unbindGeometry();
289 }
290
291 _meshRotation = mx::Vector3();
292 _meshScale = 1.0f;
293 _cameraTarget = mx::Vector3();
294
295 initCamera();
296
297 if (_shadowMap)
298 {
299 _imageHandler->releaseRenderResources(_shadowMap);
300 _shadowMap = nullptr;
301 }
302 }
303}
304
305void RenderView::setScrollEvent(float scrollY)
306{

Callers 1

drawGraphMethod · 0.45

Calls 7

Vector3Function · 0.85
clearGeometryMethod · 0.80
splitByUdimsMethod · 0.80
loadGeometryMethod · 0.45
clearMethod · 0.45
unbindGeometryMethod · 0.45

Tested by

no test coverage detected