00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "CaelumPrecompiled.h"
00022 #include "FastGpuParamRef.h"
00023
00024 using namespace Ogre;
00025
00026 namespace Caelum
00027 {
00028 FastGpuParamRef::FastGpuParamRef(Ogre::GpuProgramParametersSharedPtr paramsPtr, const Ogre::String& name)
00029 {
00030 this->bind(paramsPtr, name);
00031 }
00032
00033 void FastGpuParamRef::bind(
00034 Ogre::GpuProgramParametersSharedPtr params,
00035 const Ogre::String& name,
00036 bool throwIfNotFound)
00037 {
00038 assert(!params.isNull());
00039 #if CAELUM_DEBUG_PARAM_REF
00040 mParams = params;
00041 #endif
00042 const GpuConstantDefinition* def = params->_findNamedConstantDefinition(name, throwIfNotFound);
00043 if (def) {
00044 mPhysicalIndex = def->physicalIndex;
00045 assert(this->isBound());
00046 } else {
00047 mPhysicalIndex = InvalidPhysicalIndex;
00048 assert(!this->isBound());
00049 }
00050 }
00051
00052 void FastGpuParamRef::unbind() {
00053 #if CAELUM_DEBUG_PARAM_REF
00054 mParams.setNull();
00055 #endif
00056 mPhysicalIndex = InvalidPhysicalIndex;
00057 assert(!this->isBound());
00058 }
00059 }