void CoronaRenderer::defineGeometry() { for(size_t objId = 0; objId < this->mtco_scene->objectList.size(); objId++) { mtco_MayaObject *obj = (mtco_MayaObject *)this->mtco_scene->objectList[objId]; if( !obj->mobject.hasFn(MFn::kMesh)) continue; Corona::IGeometryGroup* geom = getGeometryPointer(obj); if( geom == NULL ) { logger.debug(MString("Geo pointer is NULL")); continue; } if( !obj->visible ) continue; Corona::AnimatedAffineTm atm; this->setAnimatedTransformationMatrix(atm, obj); obj->instance = geom->addInstance(atm, NULL, NULL); this->defineMaterial(obj->instance, obj); } for(size_t objId = 0; objId < this->mtco_scene->instancerNodeElements.size(); objId++) { mtco_MayaObject *obj = (mtco_MayaObject *)this->mtco_scene->instancerNodeElements[objId]; if( !obj->mobject.hasFn(MFn::kMesh)) continue; Corona::IGeometryGroup* geom = getGeometryPointer(obj); if( geom == NULL ) { logger.error(MString("Geo pointer is NULL")); continue; } Corona::AnimatedAffineTm atm; this->setAnimatedTransformationMatrix(atm, obj); obj->instance = geom->addInstance(atm, NULL, NULL); this->defineMaterial(obj->instance, obj); } //// first instance with two materials //IInstance* instance = geom->addInstance(AffineTm::IDENTITY); //instance->addMaterial(IMaterialSet(getNativeMtl(settings))); //instance->addMaterial(IMaterialSet(getNativeMtl(settings))); }
void CoronaRenderer::defineGeometry() { std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr; for (auto mobj : mayaScene->objectList) { std::shared_ptr<mtco_MayaObject> obj = std::static_pointer_cast<mtco_MayaObject>(mobj); if( !obj->mobject.hasFn(MFn::kMesh)) continue; Corona::IGeometryGroup* geom = getGeometryPointer(obj); if( geom == nullptr ) { Logging::debug(MString("Geo pointer is nullptr")); continue; } if( !obj->visible ) continue; Corona::AnimatedAffineTm atm; this->setAnimatedTransformationMatrix(atm, obj); obj->instance = geom->addInstance(atm, obj.get(), nullptr); MFnDependencyNode depFn(obj->mobject); if (getBoolAttr("mtco_envPortal", depFn, false)) { Corona::EnviroPortalMtlData data; Corona::SharedPtr<Corona::IMaterial> mat = data.createMaterial(); Corona::IMaterialSet ms = Corona::IMaterialSet(mat); obj->instance->addMaterial(ms); } else{ this->defineMaterial(obj->instance, obj); } //context.core->sanityCheck(context.scene); } for (auto mobj : mayaScene->instancerNodeElements) { std::shared_ptr<mtco_MayaObject> obj = std::static_pointer_cast<mtco_MayaObject>(mobj); if (!obj->mobject.hasFn(MFn::kMesh)) continue; Corona::IGeometryGroup* geom = getGeometryPointer(obj); if (geom == nullptr) { Logging::error(MString("Geo pointer of ") + obj->shortName + "is nullptr"); continue; } Corona::AnimatedAffineTm atm; this->setAnimatedTransformationMatrix(atm, obj); obj->instance = geom->addInstance(atm, obj.get(), nullptr); MFnDependencyNode depFn(obj->mobject); if (getBoolAttr("mtco_envPortal", depFn, false)) { Corona::EnviroPortalMtlData data; Corona::SharedPtr<Corona::IMaterial> mat = data.createMaterial(); Corona::IMaterialSet ms = Corona::IMaterialSet(mat); obj->instance->addMaterial(ms); } else{ this->defineMaterial(obj->instance, obj); } } }