Changeset 2358
- Timestamp:
- Dec 8, 2008, 10:01:22 PM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/tools/Shader.cc
r2350 r2358 63 63 this->compositor_ = ""; 64 64 this->oldcompositor_ = ""; 65 // this->parameter_ = 0;66 65 67 66 if (this->bLoadCompositor_ && Ogre::Root::getSingletonPtr()) … … 107 106 this->updateVisibility(); 108 107 } 109 110 /*111 COUT(0) << std::endl << "GpuPrograms:" << std::endl;112 Ogre::GpuProgramManager::ResourceMapIterator iterator = Ogre::GpuProgramManager::getSingleton().getResourceIterator();113 while (iterator.hasMoreElements())114 COUT(0) << iterator.getNext()->getName() << std::endl;115 */116 /*117 Ogre::Resource* resource = Ogre::GpuProgramManager::getSingleton().getByName("Radial_Blur_ps_cg").get();118 if (resource)119 {120 COUT(0) << std::endl << "Resource parameters:" << std::endl;121 const Ogre::ParameterList& resourceparameters = resource->getParameters();122 for (size_t i = 0; i < resourceparameters.size(); ++i)123 COUT(0) << resourceparameters[i].name << std::endl;124 125 COUT(0) << std::endl << "GpuProgram:" << std::endl;126 Ogre::GpuProgram* gpuprogram = (Ogre::GpuProgram*)resource;127 COUT(0) << gpuprogram << std::endl;128 129 COUT(0) << std::endl << "GpuProgram default parameters:" << std::endl;130 Ogre::GpuProgramParameters* defaultparams = gpuprogram->getDefaultParameters().get();131 COUT(0) << defaultparams << std::endl;132 if (defaultparams)133 {134 // defaultparams->setNamedConstant("sampleStrength", 2.0f);135 136 const Ogre::GpuConstantDefinitionMap& constantdefinitions = defaultparams->getConstantDefinitions().map;137 for (Ogre::GpuConstantDefinitionMap::const_iterator it = constantdefinitions.begin(); it != constantdefinitions.end(); ++it)138 COUT(0) << it->first << " / " << it->second.physicalIndex << " / " << it->second.isFloat() << " / " << (float)((it->second.isFloat()) ? (*defaultparams->getFloatPointer(it->second.physicalIndex)) : (*defaultparams->getIntPointer(it->second.physicalIndex))) << std::endl;139 140 Ogre::GpuConstantDefinitionMap::const_iterator it = constantdefinitions.find("sampleStrength");141 if (it != constantdefinitions.end())142 {143 if (it->second.isFloat())144 {145 COUT(0) << (defaultparams->getFloatPointer(it->second.physicalIndex)) << std::endl;146 COUT(0) << (*defaultparams->getFloatPointer(it->second.physicalIndex)) << std::endl;147 (*defaultparams->getFloatPointer(it->second.physicalIndex)) = 10.0f;148 }149 else150 {151 COUT(0) << (defaultparams->getIntPointer(it->second.physicalIndex)) << std::endl;152 COUT(0) << (*defaultparams->getIntPointer(it->second.physicalIndex)) << std::endl;153 (*defaultparams->getIntPointer(it->second.physicalIndex)) = 10;154 }155 // doesn't work because it's "manually loaded":156 //157 // Ogre: Creating viewport on target 'rtt/166241248', rendering from camera '140', relative158 // dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0159 //160 // Ogre: WARNING: Texture instance 'CompositorInstanceTexture0' was defined as manually161 // loaded, but no manual loader was provided. This Resource will be lost if it has to be162 // reloaded.163 //164 // gpuprogram->reload();165 }166 167 }168 169 COUT(0) << "end" << std::endl;170 }171 */172 /*173 if (this->parameter_ && this->bViewportInitialized_)174 {175 (*this->parameter_) += dt;176 177 if (this->compositorInstance_ && this->isVisible())178 {179 this->compositorInstance_->setEnabled(false);180 this->compositorInstance_->setEnabled(true);181 }182 }183 */184 185 // this->setParameter("Ogre/Compositor/Radial_Blur", 0, 0, "sampleStrength", Shader::getParameter("Ogre/Compositor/Radial_Blur", 0, 0, "sampleStrength") + dt / 3.0f);186 // this->setParameter("Ogre/Compositor/Tiling", 0, 0, "NumTiles", Shader::getParameter("Ogre/Compositor/Tiling", 0, 0, "NumTiles") + dt);187 108 } 188 109 … … 203 124 if (!this->compositorInstance_) 204 125 COUT(2) << "Warning: Couldn't load compositor with name \"" << this->compositor_ << "\"." << std::endl; 205 else206 {207 /*208 COUT(0) << std::endl << "GpuPrograms:" << std::endl;209 Ogre::GpuProgramManager::ResourceMapIterator gpuprogramiterator = Ogre::GpuProgramManager::getSingleton().getResourceIterator();210 while (gpuprogramiterator.hasMoreElements())211 COUT(0) << gpuprogramiterator.getNext()->getName() << std::endl;212 */213 /*214 COUT(0) << std::endl << "compositor:" << std::endl;215 Ogre::Compositor* compositor = this->compositorInstance_->getCompositor();216 COUT(0) << compositor << std::endl;217 218 if (!compositor)219 return;220 221 COUT(0) << std::endl << "compositor parameters:" << std::endl;222 const Ogre::ParameterList& compparameters = compositor->getParameters();223 for (size_t i = 0; i < compparameters.size(); ++i)224 COUT(0) << compparameters[i].name << std::endl;225 226 COUT(0) << std::endl << "compositor technique:" << std::endl;227 Ogre::CompositionTechnique* comptechnique = compositor->getSupportedTechnique(0);228 COUT(0) << comptechnique << std::endl;229 230 if (!comptechnique)231 return;232 233 COUT(0) << std::endl << "compositor target pass:" << std::endl;234 Ogre::CompositionTargetPass* comptargetpass = comptechnique->getTargetPass(0);235 COUT(0) << comptargetpass << std::endl;236 237 if (!comptargetpass)238 return;239 240 COUT(0) << std::endl << "compositor pass:" << std::endl;241 Ogre::CompositionPass* comppass = comptargetpass->getPass(0);242 COUT(0) << comppass << std::endl;243 244 if (!comppass)245 return;246 247 COUT(0) << std::endl << "material:" << std::endl;248 Ogre::Material* material = comppass->getMaterial().get();249 COUT(0) << material << std::endl;250 */251 /*252 COUT(0) << std::endl << "Materials:" << std::endl;253 Ogre::MaterialManager::ResourceMapIterator iterator = Ogre::MaterialManager::getSingleton().getResourceIterator();254 Ogre::Material* material = 0;255 while (iterator.hasMoreElements())256 {257 Ogre::Resource* resource = iterator.getNext().get();258 COUT(0) << resource->getName() << std::endl;259 if (resource->getName() == "Ogre/Compositor/Radial_Blur")260 {261 material = (Ogre::Material*)resource;262 COUT(0) << "found it!" << std::endl;263 }264 }265 266 if (!material)267 return;268 269 COUT(0) << std::endl << "material parameters:" << std::endl;270 const Ogre::ParameterList& materialparameters = material->getParameters();271 for (size_t i = 0; i < materialparameters.size(); ++i)272 COUT(0) << materialparameters[i].name << std::endl;273 274 COUT(0) << std::endl << "technique:" << std::endl;275 Ogre::Technique* technique = material->getTechnique(0);276 COUT(0) << technique << std::endl;277 278 if (!technique)279 return;280 281 COUT(0) << std::endl << "pass:" << std::endl;282 Ogre::Pass* pass = technique->getPass(0);283 COUT(0) << pass << std::endl;284 285 if (!pass)286 return;287 288 COUT(0) << std::endl << "fragment program parameters:" << std::endl;289 Ogre::GpuProgramParameters* fragmentparams = pass->getFragmentProgramParameters().get();290 COUT(0) << fragmentparams << std::endl;291 if (fragmentparams)292 {293 const Ogre::GpuConstantDefinitionMap& constantdefinitions = fragmentparams->getConstantDefinitions().map;294 for (Ogre::GpuConstantDefinitionMap::const_iterator it = constantdefinitions.begin(); it != constantdefinitions.end(); ++it)295 COUT(0) << it->first << " / " << it->second.physicalIndex << " / " << it->second.isFloat() << " / " << (float)((it->second.isFloat()) ? (*fragmentparams->getFloatPointer(it->second.physicalIndex)) : (*fragmentparams->getIntPointer(it->second.physicalIndex))) << std::endl;296 297 Ogre::GpuConstantDefinitionMap::const_iterator it = constantdefinitions.find("sampleStrength");298 299 if (it != constantdefinitions.end())300 {301 if (it->second.isFloat())302 {303 COUT(0) << (fragmentparams->getFloatPointer(it->second.physicalIndex)) << std::endl;304 COUT(0) << (*fragmentparams->getFloatPointer(it->second.physicalIndex)) << std::endl;305 (*fragmentparams->getFloatPointer(it->second.physicalIndex)) = 0.0f;306 this->parameter_ = fragmentparams->getFloatPointer(it->second.physicalIndex);307 }308 else309 {310 COUT(0) << (fragmentparams->getIntPointer(it->second.physicalIndex)) << std::endl;311 COUT(0) << (*fragmentparams->getIntPointer(it->second.physicalIndex)) << std::endl;312 (*fragmentparams->getIntPointer(it->second.physicalIndex)) = 0;313 }314 }315 }316 317 COUT(0) << std::endl << "fragment program:" << std::endl;318 COUT(0) << (&pass->getFragmentProgram()) << std::endl;319 320 COUT(0) << std::endl << "fragment program name:" << std::endl;321 COUT(0) << pass->getFragmentProgramName() << std::endl;322 323 COUT(0) << std::endl << "GpuProgram default parameters:" << std::endl;324 Ogre::GpuProgramParameters* defaultparams = pass->getFragmentProgram().get()->getDefaultParameters().get();325 COUT(0) << defaultparams << std::endl;326 if (defaultparams)327 {328 const Ogre::GpuConstantDefinitionMap& constantdefinitions = defaultparams->getConstantDefinitions().map;329 for (Ogre::GpuConstantDefinitionMap::const_iterator it = constantdefinitions.begin(); it != constantdefinitions.end(); ++it)330 COUT(0) << it->first << " / " << it->second.physicalIndex << " / " << it->second.isFloat() << " / " << (float)((it->second.isFloat()) ? (*defaultparams->getFloatPointer(it->second.physicalIndex)) : (*defaultparams->getIntPointer(it->second.physicalIndex))) << std::endl;331 }332 333 COUT(0) << std::endl << "end" << std::endl;334 */335 }336 126 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, this->compositor_, this->bViewportInitialized_ && this->isVisible()); 337 127 } -
code/branches/objecthierarchy2/src/orxonox/tools/Shader.h
r2350 r2358 99 99 std::string compositor_; 100 100 std::string oldcompositor_; 101 // float* parameter_; 102 // std::map<std::string, std::vector<std::vector<std::map<std::string, std::pair<bool, void*> > > > > parameters_; 101 103 102 static MaterialMap parameters_s; 104 103 static bool bLoadedCgPlugin_s;
Note: See TracChangeset
for help on using the changeset viewer.