| 252 | } |
| 253 | |
| 254 | void 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 | |
| 305 | void RenderView::setScrollEvent(float scrollY) |
| 306 | { |
no test coverage detected