Пример #1
0
void EventSystem::createMessages() {
  SDL_Event event;
  auto messenger = Messenger::getInstance();
  Message* msg;
  while(SDL_PollEvent(&event)) {
    if (event.type == SDL_QUIT) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_QUIT);
    }
    
    else if (event.type == SDL_APP_TERMINATING) {
	msg = messenger->appendMessage();
	std::cout << "App Terminating..." << std::endl;
	msg->setType(enumMessageType::EVENT_QUIT);
    }

    else if (event.type == SDL_APP_LOWMEMORY) {
	msg = messenger->appendMessage();
	std::cerr << "Low Memory: Calling Event Quit" << std::endl;
	msg->setType(enumMessageType::EVENT_QUIT);
    }

    else if (event.type == SDL_APP_WILLENTERBACKGROUND) {
	
    }

    else if (event.type == SDL_APP_DIDENTERBACKGROUND) {

    }

    else if (event.type == SDL_APP_WILLENTERFOREGROUND) {

    }

    else if (event.type == SDL_APP_DIDENTERFOREGROUND) {

    }

    else if (event.type == SDL_WINDOWEVENT) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_WINDOW);
    }

    else if (event.type == SDL_SYSWMEVENT) {
	
    }

    else if (event.type == SDL_KEYDOWN) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_KEYBOARD);

	//The key code
	stringType keyCodeString = SDL_GetScancodeName(event.key.keysym.scancode);
	msg->customData["Key"] = CustomAttribute(keyCodeString);
	
	//whether it was key down or key up
	msg->customData["bKeyDown"] = CustomAttribute(true);

    }

    else if (event.type == SDL_KEYUP) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_KEYBOARD);

	//The key code
	stringType keyCodeString = SDL_GetScancodeName(event.key.keysym.scancode);
	msg->customData["Key"] = CustomAttribute(keyCodeString);
	
	//whether it was key down or key up
	msg->customData["bKeyDown"] = CustomAttribute(false);
    }

    else if (event.type == SDL_TEXTEDITING) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TEXT_EDIT);
    }

    else if (event.type == SDL_TEXTINPUT) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TEXT_INPUT);
    }

    else if (event.type == SDL_MOUSEMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_MOUSE_MOVE);

	floatType xPosition = event.motion.x;
	floatType yPosition = event.motion.y;
	msg->customData["x"] = CustomAttribute(xPosition);
	msg->customData["y"] = CustomAttribute(yPosition);

	floatType xRelative = event.motion.xrel;
	floatType yRelative = event.motion.yrel;
	msg->customData["xrel"] = CustomAttribute(xRelative);
	msg->customData["yrel"] = CustomAttribute(yRelative);
    }

    else if (event.type == SDL_MOUSEBUTTONDOWN) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_MOUSE_BUTTON);
    }

    else if (event.type == SDL_MOUSEBUTTONUP) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_MOUSE_BUTTON);
    }

    else if (event.type == SDL_MOUSEWHEEL) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_MOUSE_WHEEL);
    }

    else if (event.type == SDL_JOYAXISMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_AXIS);
    }

    else if (event.type == SDL_JOYBALLMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_BALL);
    }

    else if (event.type == SDL_JOYHATMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_HAT);
    }

    else if (event.type == SDL_JOYBUTTONDOWN) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_BUTTON);
    }

    else if (event.type == SDL_JOYBUTTONUP) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_BUTTON);
    }

    else if (event.type == SDL_JOYDEVICEADDED) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_DEVICE);
    }

    else if (event.type == SDL_JOYDEVICEREMOVED) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_JOYSTICK_DEVICE);
    }

    else if (event.type == SDL_CONTROLLERAXISMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_AXIS);
    }

    else if (event.type == SDL_CONTROLLERBUTTONDOWN) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_BUTTON);
    }

    else if (event.type == SDL_CONTROLLERBUTTONUP) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_BUTTON);
    }

    else if (event.type == SDL_CONTROLLERDEVICEADDED) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_DEVICE);
    }

    else if (event.type == SDL_CONTROLLERDEVICEREMOVED) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_DEVICE);
    }

    else if (event.type == SDL_CONTROLLERDEVICEREMAPPED) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_CONTROLLER_DEVICE);
    }

    else if (event.type == SDL_FINGERDOWN) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TOUCH_SINGLE);
    }

    else if (event.type == SDL_FINGERUP) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TOUCH_SINGLE);
    }

    else if (event.type == SDL_FINGERMOTION) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TOUCH_SINGLE);
    }

    else if (event.type == SDL_DOLLARGESTURE) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TOUCH_DOLLAR);
    }

    else if (event.type == SDL_CLIPBOARDUPDATE) {

    }

    else if (event.type == SDL_DROPFILE) {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::EVENT_TOUCH_SINGLE);
    }

    else if (event.type == SDL_LASTEVENT) {
	
    }

    else {
	msg = messenger->appendMessage();
	msg->setType(enumMessageType::NONE);
    }
  } //END while(...
}
namespace Ogre {

//  a  builtin				custom attrib name
// ----------------------------------------------
//	0  gl_Vertex			vertex
//  1  n/a					blendWeights
//	2  gl_Normal			normal
//	3  gl_Color				colour
//	4  gl_SecondaryColor	secondary_colour
//	5  gl_FogCoord			fog_coord
//  7  n/a					blendIndices
//	8  gl_MultiTexCoord0	uv0
//	9  gl_MultiTexCoord1	uv1
//	10 gl_MultiTexCoord2	uv2
//	11 gl_MultiTexCoord3	uv3
//	12 gl_MultiTexCoord4	uv4
//	13 gl_MultiTexCoord5	uv5
//	14 gl_MultiTexCoord6	uv6, tangent
//	15 gl_MultiTexCoord7	uv7, binormal
GLSLLinkProgram::CustomAttribute GLSLLinkProgram::msCustomAttributes[] = {
    CustomAttribute("vertex", GLGpuProgram::getFixedAttributeIndex(VES_POSITION, 0)),
    CustomAttribute("blendWeights", GLGpuProgram::getFixedAttributeIndex(VES_BLEND_WEIGHTS, 0)),
    CustomAttribute("normal", GLGpuProgram::getFixedAttributeIndex(VES_NORMAL, 0)),
    CustomAttribute("colour", GLGpuProgram::getFixedAttributeIndex(VES_DIFFUSE, 0)),
    CustomAttribute("secondary_colour", GLGpuProgram::getFixedAttributeIndex(VES_SPECULAR, 0)),
    CustomAttribute("blendIndices", GLGpuProgram::getFixedAttributeIndex(VES_BLEND_INDICES, 0)),
    CustomAttribute("uv0", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 0)),
    CustomAttribute("uv1", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 1)),
    CustomAttribute("uv2", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 2)),
    CustomAttribute("uv3", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 3)),
    CustomAttribute("uv4", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 4)),
    CustomAttribute("uv5", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 5)),
    CustomAttribute("uv6", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 6)),
    CustomAttribute("uv7", GLGpuProgram::getFixedAttributeIndex(VES_TEXTURE_COORDINATES, 7)),
    CustomAttribute("tangent", GLGpuProgram::getFixedAttributeIndex(VES_TANGENT, 0)),
    CustomAttribute("binormal", GLGpuProgram::getFixedAttributeIndex(VES_BINORMAL, 0)),
};

GLint getGLGeometryInputPrimitiveType(RenderOperation::OperationType operationType, bool requiresAdjacency)
{
    switch (operationType)
    {
    case RenderOperation::OT_POINT_LIST:
        return GL_POINTS;
    case RenderOperation::OT_LINE_LIST:
    case RenderOperation::OT_LINE_STRIP:
        return requiresAdjacency ? GL_LINES_ADJACENCY_EXT : GL_LINES;
    default:
    case RenderOperation::OT_TRIANGLE_LIST:
    case RenderOperation::OT_TRIANGLE_STRIP:
    case RenderOperation::OT_TRIANGLE_FAN:
        return requiresAdjacency ? GL_TRIANGLES_ADJACENCY_EXT : GL_TRIANGLES;
    }
}
//-----------------------------------------------------------------------
GLint getGLGeometryOutputPrimitiveType(RenderOperation::OperationType operationType)
{
    switch (operationType)
    {
    case RenderOperation::OT_POINT_LIST:
        return GL_POINTS;
    case RenderOperation::OT_LINE_STRIP:
        return GL_LINE_STRIP;
    case RenderOperation::OT_TRIANGLE_STRIP:
        return GL_TRIANGLE_STRIP;
    default:
        OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
                    "Geometry shader output operation type can only be point list,"
                    "line strip or triangle strip",
                    "GLSLLinkProgram::activate");
    }
}
//-----------------------------------------------------------------------
GLSLLinkProgram::GLSLLinkProgram(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* geometryProgram, GLSLGpuProgram* fragmentProgram)
    : mVertexProgram(vertexProgram)
    , mGeometryProgram(geometryProgram)
    , mFragmentProgram(fragmentProgram)
    , mUniformRefsBuilt(false)
    , mLinked(false)

{
    //checkForGLSLError( "GLSLLinkProgram::GLSLLinkProgram", "Error prior to Creating GLSL Program Object", 0);
    glGetError(); //Clean up the error. Otherwise will flood log.
    mGLHandle = glCreateProgramObjectARB();
    checkForGLSLError( "GLSLLinkProgram::GLSLLinkProgram", "Error Creating GLSL Program Object", 0 );


    // tell shaders to attach themselves to the LinkProgram
    // let the shaders do the attaching since they may have several children to attach
    if (mVertexProgram)
    {
        mVertexProgram->getGLSLProgram()->attachToProgramObject(mGLHandle);
        setSkeletalAnimationIncluded(mVertexProgram->isSkeletalAnimationIncluded());
    }
    if (mGeometryProgram)
    {
        mGeometryProgram->getGLSLProgram()->attachToProgramObject(mGLHandle);
        //Don't set adjacency flag. We handle it internally and expose "false"
    }
    if (mFragmentProgram)
    {
        mFragmentProgram->getGLSLProgram()->attachToProgramObject(mGLHandle);
    }

}

//-----------------------------------------------------------------------
GLSLLinkProgram::~GLSLLinkProgram(void)
{
    glDeleteObjectARB(mGLHandle);

}

//-----------------------------------------------------------------------
void GLSLLinkProgram::activate(void)
{
    if (!mLinked)
    {
        if (mVertexProgram)
        {
            // Some drivers (e.g. OS X on nvidia) incorrectly determine the attribute binding automatically
            // and end up aliasing existing built-ins. So avoid!
            // Bind all used attribs - not all possible ones otherwise we'll get
            // lots of warnings in the log, and also may end up aliasing names used
            // as varyings by accident
            // Because we can't ask GL whether an attribute is used in the shader
            // until it is linked (chicken and egg!) we have to parse the source

            size_t numAttribs = sizeof(msCustomAttributes)/sizeof(CustomAttribute);
            const String& vpSource = mVertexProgram->getGLSLProgram()->getSource();
            for (size_t i = 0; i < numAttribs; ++i)
            {
                const CustomAttribute& a = msCustomAttributes[i];

                // we're looking for either:
                //   attribute vec<n> <semantic_name>
                //   in vec<n> <semantic_name>
                // The latter is recommended in GLSL 1.3 onwards
                // be slightly flexible about formatting
                String::size_type pos = vpSource.find(a.name);
                if (pos != String::npos)
                {
                    String::size_type startpos = vpSource.find("attribute", pos < 20 ? 0 : pos-20);
                    if (startpos == String::npos)
                        startpos = vpSource.find("in", pos-20);
                    if (startpos != String::npos && startpos < pos)
                    {
                        // final check
                        String expr = vpSource.substr(startpos, pos + a.name.length() - startpos);
                        StringVector vec = StringUtil::split(expr);
                        if ((vec[0] == "in" || vec[0] == "attribute") && vec[2] == a.name)
                            glBindAttribLocationARB(mGLHandle, a.attrib, a.name.c_str());
                    }

                }
            }
        }

        if (mGeometryProgram)
        {
            RenderOperation::OperationType inputOperationType = mGeometryProgram->getGLSLProgram()->getInputOperationType();
            glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_INPUT_TYPE_EXT,
                                   getGLGeometryInputPrimitiveType(inputOperationType, mGeometryProgram->isAdjacencyInfoRequired()));

            RenderOperation::OperationType outputOperationType = mGeometryProgram->getGLSLProgram()->getOutputOperationType();
            switch (outputOperationType)
            {
            case RenderOperation::OT_POINT_LIST:
            case RenderOperation::OT_LINE_STRIP:
            case RenderOperation::OT_TRIANGLE_STRIP:
            case RenderOperation::OT_LINE_LIST:
            case RenderOperation::OT_TRIANGLE_LIST:
            case RenderOperation::OT_TRIANGLE_FAN:
                break;

            }
            glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_OUTPUT_TYPE_EXT,
                                   getGLGeometryOutputPrimitiveType(outputOperationType));

            glProgramParameteriEXT(mGLHandle,GL_GEOMETRY_VERTICES_OUT_EXT,
                                   mGeometryProgram->getGLSLProgram()->getMaxOutputVertices());
        }

        glLinkProgramARB( mGLHandle );
        glGetObjectParameterivARB( mGLHandle, GL_OBJECT_LINK_STATUS_ARB, &mLinked );
        // force logging and raise exception if not linked
        checkForGLSLError( "GLSLLinkProgram::Activate",
                           "Error linking GLSL Program Object : ", mGLHandle, !mLinked, !mLinked );
        if(mLinked)
        {
            logObjectInfo( String("GLSL link result : "), mGLHandle );
            buildGLUniformReferences();
            extractAttributes();
        }

    }

    if (mLinked)
    {
        checkForGLSLError( "GLSLLinkProgram::Activate",
                           "Error prior to using GLSL Program Object : ", mGLHandle, false, false);

        glUseProgramObjectARB( mGLHandle );

        checkForGLSLError( "GLSLLinkProgram::Activate",
                           "Error using GLSL Program Object : ", mGLHandle, false, false);
    }
}

//-----------------------------------------------------------------------
void GLSLLinkProgram::extractAttributes(void)
{
    size_t numAttribs = sizeof(msCustomAttributes)/sizeof(CustomAttribute);

    for (size_t i = 0; i < numAttribs; ++i)
    {
        const CustomAttribute& a = msCustomAttributes[i];
        GLint attrib = glGetAttribLocationARB(mGLHandle, a.name.c_str());

        if (attrib != -1)
        {
            mValidAttributes.insert(a.attrib);
        }
    }
}
//-----------------------------------------------------------------------
GLuint GLSLLinkProgram::getAttributeIndex(VertexElementSemantic semantic, uint index)
{
    return GLGpuProgram::getFixedAttributeIndex(semantic, index);
}
//-----------------------------------------------------------------------
bool GLSLLinkProgram::isAttributeValid(VertexElementSemantic semantic, uint index)
{
    return mValidAttributes.find(getAttributeIndex(semantic, index)) != mValidAttributes.end();
}
//-----------------------------------------------------------------------
void GLSLLinkProgram::buildGLUniformReferences(void)
{
    if (!mUniformRefsBuilt)
    {
        const GpuConstantDefinitionMap* vertParams = 0;
        const GpuConstantDefinitionMap* fragParams = 0;
        const GpuConstantDefinitionMap* geomParams = 0;
        if (mVertexProgram)
        {
            vertParams = &(mVertexProgram->getGLSLProgram()->getConstantDefinitions().map);
        }
        if (mGeometryProgram)
        {
            geomParams = &(mGeometryProgram->getGLSLProgram()->getConstantDefinitions().map);
        }
        if (mFragmentProgram)
        {
            fragParams = &(mFragmentProgram->getGLSLProgram()->getConstantDefinitions().map);
        }

        GLSLLinkProgramManager::getSingleton().extractUniforms(
            mGLHandle, vertParams, geomParams, fragParams, mGLUniformReferences);

        mUniformRefsBuilt = true;
    }
}

//-----------------------------------------------------------------------
void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params,
                                     uint16 mask, GpuProgramType fromProgType)
{
    // iterate through uniform reference list and update uniform values
    GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
    GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

    for (; currentUniform != endUniform; ++currentUniform)
    {
        // Only pull values from buffer it's supposed to be in (vertex or fragment)
        // This method will be called twice, once for vertex program params,
        // and once for fragment program params.
        if (fromProgType == currentUniform->mSourceProgType)
        {
            const GpuConstantDefinition* def = currentUniform->mConstantDef;
            if (def->variability & mask)
            {

                GLsizei glArraySize = (GLsizei)def->arraySize;

                // get the index in the parameter real list
                switch (def->constType)
                {
                case GCT_FLOAT1:
                    glUniform1fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT2:
                    glUniform2fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT3:
                    glUniform3fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_FLOAT4:
                    glUniform4fvARB(currentUniform->mLocation, glArraySize,
                                    params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_2X2:
                    glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_2X3:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_2X4:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_3X2:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_3X3:
                    glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_MATRIX_3X4:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X2:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X3:
                    if (GLEW_VERSION_2_1)
                    {
                        glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize,
                                             GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    }
                    break;
                case GCT_MATRIX_4X4:
                    glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize,
                                          GL_TRUE, params->getFloatPointer(def->physicalIndex));
                    break;
                case GCT_INT1:
                    glUniform1ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT2:
                    glUniform2ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT3:
                    glUniform3ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_INT4:
                    glUniform4ivARB(currentUniform->mLocation, glArraySize,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_SAMPLER1D:
                case GCT_SAMPLER1DSHADOW:
                case GCT_SAMPLER2D:
                case GCT_SAMPLER2DSHADOW:
                case GCT_SAMPLER3D:
                case GCT_SAMPLERCUBE:
                    // samplers handled like 1-element ints
                    glUniform1ivARB(currentUniform->mLocation, 1,
                                    (GLint*)params->getIntPointer(def->physicalIndex));
                    break;
                case GCT_UNKNOWN:
                    break;

                } // end switch
#if OGRE_DEBUG_MODE
                checkForGLSLError( "GLSLLinkProgram::updateUniforms", "Error updating uniform", 0 );
#endif
            } // variability & mask
        } // fromProgType == currentUniform->mSourceProgType

    } // end for
}


//-----------------------------------------------------------------------
void GLSLLinkProgram::updatePassIterationUniforms(GpuProgramParametersSharedPtr params)
{
    if (params->hasPassIterationNumber())
    {
        size_t index = params->getPassIterationNumberIndex();

        GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin();
        GLUniformReferenceIterator endUniform = mGLUniformReferences.end();

        // need to find the uniform that matches the multi pass entry
        for (; currentUniform != endUniform; ++currentUniform)
        {
            // get the index in the parameter real list
            if (index == currentUniform->mConstantDef->physicalIndex)
            {
                glUniform1fvARB( currentUniform->mLocation, 1, params->getFloatPointer(index));
                // there will only be one multipass entry
                return;
            }
        }
    }

}
} // namespace Ogre