bool ParameterManager::handleMessage(const message::SetParameter ¶m) { // sent by controller switch (param.getParameterType()) { case Parameter::Integer: setIntParameter(param.getName(), param.getInteger(), ¶m); break; case Parameter::Float: setFloatParameter(param.getName(), param.getFloat(), ¶m); break; case Parameter::Vector: setVectorParameter(param.getName(), param.getVector(), ¶m); break; case Parameter::IntVector: setIntVectorParameter(param.getName(), param.getIntVector(), ¶m); break; case Parameter::String: setStringParameter(param.getName(), param.getString(), ¶m); break; default: std::cerr << "Module::handleMessage: unknown parameter type " << param.getParameterType() << std::endl; vassert("unknown parameter type" == 0); break; } return true; }
void write() { Abc::OArchive archive( Alembic::AbcCoreHDF5::WriteArchive(), "MaterialAssignment.abc" ); Abc::OObject root(archive, Abc::kTop); Abc::OObject materials(root, "materials"); Abc::OObject geometry(root, "geometry"); //parent material Mat::OMaterial materialA(materials, "materialA"); materialA.getSchema().setShader("prman", "surface", "paintedplastic"); setFloatParameter(materialA.getSchema(), "prman", "surface", "Kd", 0.5); setFloatParameter(materialA.getSchema(), "prman", "surface", "roughness", 0.1); //child material Mat::OMaterial materialB(materialA, "materialB"); materialB.getSchema().setShader("prman", "displacement", "knobby"); setFloatParameter(materialB.getSchema(), "prman", "surface", "roughness", 0.2); Abc::OObject geoA(geometry, "geoA"); Mat::addMaterialAssignment(geoA, "/materials/materialA"); Abc::OObject geoB(geometry, "geoB"); Mat::addMaterialAssignment(geoB, "/materials/materialA/materialB"); Abc::OObject geoC(geometry, "geoC"); Mat::addMaterialAssignment(geoC, "/materials/materialA/materialB"); Mat::OMaterialSchema geoCMat = Mat::addMaterial(geoC); setFloatParameter(geoCMat, "prman", "surface", "roughness", 0.3); }