Commits

Steve Streeting committed e88ed30

Added support for spotlight_viewproj_matrix_array GPU parameter

  • Participants
  • Parent commits 6813426
  • Branches v1-7

Comments (0)

Files changed (3)

File Docs/src/manual.texi

 As texture_worldviewproj_matrix, except an array of matrices is passed, up to the number that you specify as the 'extra_params' value.
 @item spotlight_viewproj_matrix
 Provides a view / projection matrix which matches the set up of a given spotlight (requires an 'extra_params' entry to indicate the light index, which must be a spotlight). Can be used to project a texture from a given spotlight.
+@item spotlight_viewproj_matrix_array
+As spotlight_viewproj_matrix, except an array of matrices is passed, up to the number that you specify as the 'extra_params' value.
 @item spotlight_worldviewproj_matrix
 As spotlight_viewproj_matrix except it also includes the world matrix.
 @item scene_depth_range

File OgreMain/include/OgreGpuProgramParams.h

 			ACT_TEXTURE_WORLDVIEWPROJ_MATRIX_ARRAY,
 			/// The view/projection matrix of a given spotlight
 			ACT_SPOTLIGHT_VIEWPROJ_MATRIX,
+			/// Array of view/projection matrix of a given spotlight
+			ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY,
 			/** The view/projection matrix of a given spotlight projection frustum, 
 			combined with the current world matrix
 			*/

File OgreMain/src/OgreGpuProgramParams.cpp

 		AutoConstantDefinition(ACT_TEXTURE_WORLDVIEWPROJ_MATRIX,  "texture_worldviewproj_matrix",16, ET_REAL, ACDT_INT),
 		AutoConstantDefinition(ACT_TEXTURE_WORLDVIEWPROJ_MATRIX_ARRAY, "texture_worldviewproj_matrix_array",16, ET_REAL, ACDT_INT),
 		AutoConstantDefinition(ACT_SPOTLIGHT_VIEWPROJ_MATRIX,       "spotlight_viewproj_matrix",     16, ET_REAL, ACDT_INT),
+		AutoConstantDefinition(ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY, "spotlight_viewproj_matrix_array", 16, ET_REAL, ACDT_INT),
 		AutoConstantDefinition(ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX,  "spotlight_worldviewproj_matrix",16, ET_REAL, ACDT_INT),
 		AutoConstantDefinition(ACT_CUSTOM,                        "custom",                       4, ET_REAL, ACDT_INT),  // *** needs to be tested
 		AutoConstantDefinition(ACT_TIME,                               "time",                               1, ET_REAL, ACDT_REAL),
 		case ACT_TEXTURE_VIEWPROJ_MATRIX:
 		case ACT_TEXTURE_VIEWPROJ_MATRIX_ARRAY:
 		case ACT_SPOTLIGHT_VIEWPROJ_MATRIX:
+		case ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY:
 		case ACT_LIGHT_CUSTOM:
 
 			return (uint16)GPV_LIGHTS;
 				case ACT_SPOTLIGHT_VIEWPROJ_MATRIX:
 					_writeRawConstant(i->physicalIndex, source->getSpotlightViewProjMatrix(i->data),i->elementCount);
 					break;
+				case ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY:
+					for (size_t l = 0; l < i->data; ++l)
+					{
+						// can also be updated in lights
+						_writeRawConstant(i->physicalIndex + l*i->elementCount, 
+										  source->getSpotlightViewProjMatrix(l),i->elementCount);
+					}
+					break;
+						
 				default:
 					break;
 				};