Beispiel #1
0
void GetUniforms::GLFunctionPre (uint updateID, const char *funcName, uint funcIndex, const FunctionArgs & args )
{
	char buffer[1024] = {0};
	const char *charptr;

	void *pointer;

	GLuint program = -1;
	GLuint location = -1;
	GLsizei bufSize = -1;
	GLsizei *length;
	GLint *size;

    FunctionArgs accessArgs(args);
	if (strcmp("glGetActiveUniform",funcName) == 0){

		accessArgs.Get(program);
		accessArgs.Get(location);
		accessArgs.Get(bufSize);
		accessArgs.Get(pointer); length = (GLsizei *) pointer;
		accessArgs.Get(pointer); size = (GLint *) pointer;
		accessArgs.Get(pointer); enum_holder = (GLenum *) pointer;
		accessArgs.Get(pointer); string_holder = (GLchar *) pointer;
		
		SelectUniform(program, location);

	}
	else{
		charptr = strstr(funcName,"glProgramUniform");
		if (charptr){
			accessArgs.Get(program);
			accessArgs.Get(location);
			SelectUniform(program, location);
			charptr+=16;
			selected_uniform->Update(charptr, accessArgs);
		}
	}

}
CallTypeID OpenGLCStrike::GetCallTypeID(const FunctionArgs & args) const
{
  //Determine if perspective is used
  GLfloat testProjMatrix[16];
  GLV->glGetFloatv(GL_PROJECTION_MATRIX,&testProjMatrix[0]);

  //If the "w" is not multiplied by any z, this is probably orthographic
  // (This may be a little bit of a hack)
  if(testProjMatrix[11] == 0.0f)
  {
    //The first render call could be the target cursor
    if(firstUICall)
    {
      GLint srcBlend = 0, dstBlend = 0;

      GLV->glGetIntegerv(GL_BLEND_SRC, &srcBlend);
      GLV->glGetIntegerv(GL_BLEND_DST, &dstBlend);

      //If the blend modes are correct for the crosshair
      if(srcBlend == GL_SRC_ALPHA && dstBlend == GL_ONE_MINUS_SRC_ALPHA)
      {
        return CTI_TargetCrossHair;
      }
    }

    return CTI_UI;
  }

  //Get the glBegin render type
  GLenum renderType;
  FunctionArgs accessArgs(args);
  accessArgs.Get(renderType);

  //Determine if the arguments are GL_TRIANGLES or not
  if(renderType == GL_TRIANGLE_STRIP || renderType == GL_TRIANGLE_FAN)
  {
    GLfloat depthRange[2];
    GLV->glGetFloatv(GL_DEPTH_RANGE, depthRange);

    //The character's weapon is written in a different depth range
    if(depthRange[1] == 0.85f || depthRange[1] == 0.149997f)
    {
      return CTI_Weapon;
    }

    return CTI_Character;
  }
  else
  {
    //If blending is used, assume PFX (sparks, decals, blood etc)
    GLint blendMode;
    GLV->glGetIntegerv(GL_BLEND, &blendMode);

    if(blendMode != 0)
    {
      return CTI_PFX;
    }

    return CTI_Background;
  }
}