From: <the...@us...> - 2005-05-31 16:13:46
|
Update of /cvsroot/crystal/CS/plugins/engine/renderloop/fatrl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/plugins/engine/renderloop/fatrl Modified Files: fatloop.cpp Log Message: - Marten made a few fixes to the shader system: - Removed the static variable context from csXMLShader::Compile and child methods. - Made some changes to the variable mapping holder to use less memory. - Rewrote Cg plugin to (once again) use Cg calls for parameter setting and not using the ARB_vertex_program routing. - Rewrote shader variable handing in Cg and ARB_*_p plugins to properly support matrix, transform and array datatypes. - Added matrix and transform types to SV and shader parameter loader. - Changed the SV stack to be a SV list. - Marten changed the renderloop to follow the SV context order shadermanager (global) - renderloop - sector - light - mesh - shader - material ( - shaderprogram). - Marten changed fountain meshobject to use csRandomFloatGen which hopefully is faster than normal rand(). - Marten fixed a few compile warnings in isotest.cpp. - Marten fixed environment reflective cubemap support. Index: fatloop.cpp =================================================================== RCS file: /cvsroot/crystal/CS/plugins/engine/renderloop/fatrl/fatloop.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- fatloop.cpp 28 May 2005 12:11:33 -0000 1.6 +++ fatloop.cpp 31 May 2005 16:13:07 -0000 1.7 @@ -254,38 +254,31 @@ if (mesh->variablecontext.IsValid () && !mesh->variablecontext->IsEmpty()) { + stacks.Empty (); + shadervars[shadervars_idx].PushVariables (stacks); + if (meshContext) + meshContext->PushVariables (stacks); shader->PushVariables (stacks); material->PushVariables (stacks); - if (meshContext) meshContext->PushVariables (stacks); - mesh->variablecontext->PushVariables (stacks); - shadervars[shadervars_idx].PushVariables (stacks); csRenderMeshModes modes (*mesh); size_t retTicket = shader->GetTicket (modes, stacks); - shadervars[shadervars_idx].PopVariables (stacks); - mesh->variablecontext->PopVariables (stacks); - if (meshContext) meshContext->PopVariables (stacks); - material->PopVariables (stacks); - shader->PopVariables (stacks); return retTicket; } else { if (matShadMeshTicket == (size_t)~0) { - shader->PushVariables (stacks); - material->PushVariables (stacks); - if (meshContext) meshContext->PushVariables (stacks); - shadervars[shadervars_idx].PushVariables (stacks); + stacks.Empty (); + shadervars[shadervars_idx].PushVariables (stacks); + if (meshContext) + meshContext->PushVariables (stacks); + shader->PushVariables (stacks); + material->PushVariables (stacks); csRenderMeshModes modes (*mesh); matShadMeshTicket = shader->GetTicket (modes, stacks); - - shadervars[shadervars_idx].PopVariables (stacks); - if (meshContext) meshContext->PopVariables (stacks); - material->PopVariables (stacks); - shader->PopVariables (stacks); } return matShadMeshTicket; } @@ -328,45 +321,23 @@ svO2W->SetValue (mesh->object2world); - if ((mesh->material->GetMaterial () != material) - || (meshContext != lastMeshContext)) - { - if (lastMeshContext) meshContext->PopVariables (stacks); - if (material != 0) - { - material->PopVariables (stacks); - shader->PopVariables (stacks); - } - material = mesh->material->GetMaterial (); - lastMeshContext = meshContext; - shader->PushVariables (stacks); - material->PushVariables (stacks); - if (meshContext) meshContext->PushVariables (stacks); - } + stacks.Empty (); + shaderManager->PushVariables (stacks); shadervars.Top ().PushVariables (stacks); + if (meshContext) + meshContext->PushVariables (stacks); if (mesh->variablecontext) mesh->variablecontext->PushVariables (stacks); + shader->PushVariables (stacks); + material->PushVariables (stacks); csRenderMeshModes modes (*mesh); shader->SetupPass (ticket, mesh, modes, stacks); g3d->DrawMesh (mesh, modes, stacks); shader->TeardownPass (ticket); - - if (mesh->variablecontext) - mesh->variablecontext->PopVariables (stacks); - shadervars.Top ().PopVariables (stacks); } shader->DeactivatePass (ticket); } - - if (lastMeshContext) lastMeshContext->PopVariables (stacks); - if (material != 0) - { - material->PopVariables (stacks); - shader->PopVariables (stacks); - } - - shaderManager->PopVariables (stacks); } class PriorityHelper |