I like to change a texture image parameters and colour values. This is what i got so far
I can change the viewport colour, but didn't manage to change the sphere colour.
Code: Select all
if (!ImGui::CollapsingHeader("Ambient")) {
auto ent = app.mSphere.object->getSubEntity(0);
auto mat = ent->getMaterial();
auto bgColor = mat->getTechnique(0)->getPass(0)->getAmbient();
static auto color_ref2 = ImVec4(bgColor.r, bgColor.g, bgColor.b, bgColor.a);
static ImVec4 color = color_ref2;
int flags = 0 | ImGuiColorEditFlags_NoLabel;
ImGui::ColorPicker4("AbColor", (float *)&color, flags, &color_ref2.x);
auto newColor = Ogre::ColourValue(color.x, color.y, color.z, color.w);
mat->getTechnique(0)->getPass(0)->setAmbient(newColor);
ent->setMaterial(mat);
}
I have also try to clone the material with no luck. This will generate tons of unused materials. How can i get rid of them;
Code: Select all
static auto nameGen = Ogre::NameGenerator("SphereMaterial");
auto newmatName = nameGen.generate();
auto mat2 = ent->getMaterial()->clone(newmatName);
auto newColor = Ogre::ColourValue(color.x, color.y, color.z, color.w);
mat2->getTechnique(0)->getPass(0)->setAmbient(newColor);
ent->setMaterialName(newmatName);
Ogre Version: 1.11.5
Operating System: Linux
Render System: OpenGL[3]