| 171 | } |
| 172 | |
| 173 | void RenderView::initialize() |
| 174 | { |
| 175 | // Initialize image handler. |
| 176 | _imageHandler = mx::GLTextureHandler::create(mx::StbImageLoader::create()); |
| 177 | #if MATERIALX_BUILD_OIIO |
| 178 | _imageHandler->addLoader(mx::OiioImageLoader::create()); |
| 179 | #endif |
| 180 | _imageHandler->setSearchPath(_searchPath); |
| 181 | |
| 182 | // Create geometry handler. |
| 183 | mx::TinyObjLoaderPtr objLoader = mx::TinyObjLoader::create(); |
| 184 | mx::CgltfLoaderPtr gltfLoader = mx::CgltfLoader::create(); |
| 185 | _geometryHandler = mx::GeometryHandler::create(); |
| 186 | _geometryHandler->addLoader(objLoader); |
| 187 | _geometryHandler->addLoader(gltfLoader); |
| 188 | loadMesh(_searchPath.find(_meshFilename)); |
| 189 | |
| 190 | // Initialize environment light. |
| 191 | loadEnvironmentLight(); |
| 192 | |
| 193 | // Initialize camera. |
| 194 | initCamera(); |
| 195 | |
| 196 | // Update geometry selections. |
| 197 | updateGeometrySelections(); |
| 198 | |
| 199 | _pixelRatio = 1.f; |
| 200 | } |
| 201 | |
| 202 | void RenderView::assignMaterial(mx::MeshPartitionPtr geometry, mx::GlslMaterialPtr material) |
| 203 | { |