#include "ElementProxyHeaders.hpp" //---------------------------------------------------------------------------- // bool SetExplicitAlphaModeProcess::SetExplicitAlphaMode(ChildProxy *child, MLRState::AlphaMode newAlphaMode) { Check_Object(this); Check_Object(child); if (child->IsDerivedFrom(ElementGroupProxy::DefaultData)) { ElementGroupProxy *group = Cast_Object(ElementGroupProxy*, child); return SetExplicitAlphaMode(group, newAlphaMode); } else if (child->IsDerivedFrom(ElementPolygonMeshProxy::DefaultData)) { ElementPolygonMeshProxy *mesh = Cast_Object(ElementPolygonMeshProxy*, child); return SetExplicitAlphaMode(mesh, newAlphaMode); } else if (child->IsDerivedFrom(ElementListProxy::DefaultData)) { return true; } STOP(("Shouldn't get here...")); SetExplicitAlphaModeCallback(child); return false; } //---------------------------------------------------------------------------- // bool SetExplicitAlphaModeProcess::SetExplicitAlphaMode(ElementGroupProxy* group, MLRState::AlphaMode newAlphaMode) { Check_Object(this); Check_Object(group); // //--------------------------------------- // Make sure that the process says its OK //--------------------------------------- // SetExplicitAlphaModeCallback(group); if (!continueProcess) return true; // //-------------------- // Kill the group name //-------------------- // group->SetName(NULL); // //----------------------------- // Run optimize on the children //----------------------------- // unsigned child_count = group->GetChildCount(); ChildProxy *child = group->UseFirstChildProxy(); for (unsigned i=0; iUseNextSiblingProxy(); if (SetExplicitAlphaMode(child, newAlphaMode)) child->DetachReference(); child = next; if (!continueProcess) break; } // //------------------------------------------- // Make sure to discard any remaining proxies //------------------------------------------- // if (child) child->DetachReference(); return false; } //---------------------------------------------------------------------------- // bool SetExplicitAlphaModeProcess::SetExplicitAlphaMode(ElementPolygonMeshProxy* mesh, MLRState::AlphaMode newAlphaMode) { Check_Object(this); Check_Object(mesh); // //--------------------------------------- // Make sure that the process says its OK //--------------------------------------- // SetExplicitAlphaModeCallback(mesh); if (!continueProcess) return true; // // Set the alpha mode // unsigned unique_combinations = mesh->GetPrimitiveCount(); for (int i = 0; i < unique_combinations; i++) { MLR_I_PMesh *primitive = mesh->GetPrimitive(i); Check_Object(primitive); MLRState state = primitive->GetReferenceState(); state.SetAlphaMode(newAlphaMode); primitive->SetReferenceState(state); } return true; } //---------------------------------------------------------------------------- // void SetExplicitAlphaModeProcess::SetExplicitAlphaMode(ElementSceneProxy* scene, MLRState::AlphaMode newAlphaMode) { Check_Object(this); Check_Object(scene); // //--------------------------------------- // Make sure that the process says its OK //--------------------------------------- // SetExplicitAlphaModeCallback(scene); if (!continueProcess) return; // //----------------------------- // Run optimize on the children //----------------------------- // ChildProxy *child = scene->UseFirstChildProxy(); while (child) { Check_Object(child); ChildProxy *next = child->UseNextSiblingProxy(); if (SetExplicitAlphaMode(child, newAlphaMode)) child->DetachReference(); child = next; if (!continueProcess) break; } // //------------------------------------------- // Make sure to discard any remaining proxies //------------------------------------------- // if (child) child->DetachReference(); }