Showing the changes to libraries/render-utils/src/Model.cpp (1 of 17 files). Show all
Unified · Split
| @@ -36,7 +36,25 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "Model.h" |
| 37 | 37 | |
| 38 | 38 | #include "model_vert.h" |
| 39 | +#include "model_shadow_vert.h" | |
| 40 | +#include "model_normal_map_vert.h" | |
| 41 | +#include "model_lightmap_vert.h" | |
| 42 | +#include "model_lightmap_normal_map_vert.h" | |
| 43 | +#include "skin_model_vert.h" | |
| 44 | +#include "skin_model_shadow_vert.h" | |
| 45 | +#include "skin_model_normal_map_vert.h" | |
| 46 | + | |
| 39 | 47 | #include "model_frag.h" |
| 48 | +#include "model_shadow_frag.h" | |
| 49 | +#include "model_normal_map_frag.h" | |
| 50 | +#include "model_normal_specular_map_frag.h" | |
| 51 | +#include "model_specular_map_frag.h" | |
| 52 | +#include "model_lightmap_frag.h" | |
| 53 | +#include "model_lightmap_normal_map_frag.h" | |
| 54 | +#include "model_lightmap_normal_specular_map_frag.h" | |
| 55 | +#include "model_lightmap_specular_map_frag.h" | |
| 56 | +#include "model_translucent_frag.h" | |
| 57 | + | |
| 40 | 58 | |
| 41 | 59 | #define GLBATCH( call ) batch._##call |
| 42 | 60 | //#define GLBATCH( call ) call |
| @@ -237,106 +255,69 @@ void Model::init() { · 194 unmodified lines | ||
| 237 | 255 | if (!_program.isLinked()) { |
| 238 | 256 | _program.addShaderFromSourceCode(QGLShader::Vertex, model_vert); |
| 239 | 257 | _program.addShaderFromSourceCode(QGLShader::Fragment, model_frag); |
| 240 | − | |
| 241 | 258 | initProgram(_program, _locations); |
| 242 | 259 | |
| 243 | − _normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 244 | − PathUtils::resourcesPath() + "shaders/model_normal_map.vert"); | |
| 245 | − _normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 246 | − PathUtils::resourcesPath() + "shaders/model_normal_map.frag"); | |
| 247 | − | |
| 248 | − initProgram(_normalMapProgram, _normalMapLocations); | |
| 249 | − | |
| 250 | − _specularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_vert); | |
| 251 | − _specularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 252 | − PathUtils::resourcesPath() + "shaders/model_specular_map.frag"); | |
| 253 | − | |
| 254 | − initProgram(_specularMapProgram, _specularMapLocations); | |
| 255 | − | |
| 256 | − _normalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 257 | − PathUtils::resourcesPath() + "shaders/model_normal_map.vert"); | |
| 258 | − _normalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 259 | − PathUtils::resourcesPath() + "shaders/model_normal_specular_map.frag"); | |
| 260 | − | |
| 261 | − initProgram(_normalSpecularMapProgram, _normalSpecularMapLocations); | |
| 262 | − | |
| 263 | − _translucentProgram.addShaderFromSourceCode(QGLShader::Vertex, model_vert); | |
| 264 | − _translucentProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 265 | − PathUtils::resourcesPath() + "shaders/model_translucent.frag"); | |
| 266 | − | |
| 267 | − initProgram(_translucentProgram, _translucentLocations); | |
| 268 | − | |
| 269 | − // Lightmap | |
| 270 | − _lightmapProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/model_lightmap.vert"); | |
| 271 | − _lightmapProgram.addShaderFromSourceFile(QGLShader::Fragment, PathUtils::resourcesPath() + "shaders/model_lightmap.frag"); | |
| 272 | − | |
| 273 | − initProgram(_lightmapProgram, _lightmapLocations); | |
| 274 | − | |
| 275 | − _lightmapNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 276 | − PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.vert"); | |
| 277 | − _lightmapNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 278 | − PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.frag"); | |
| 279 | − | |
| 280 | − initProgram(_lightmapNormalMapProgram, _lightmapNormalMapLocations); | |
| 281 | − | |
| 282 | − _lightmapSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 283 | − PathUtils::resourcesPath() + "shaders/model_lightmap.vert"); | |
| 284 | − _lightmapSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 285 | − PathUtils::resourcesPath() + "shaders/model_lightmap_specular_map.frag"); | |
| 286 | − | |
| 287 | − initProgram(_lightmapSpecularMapProgram, _lightmapSpecularMapLocations); | |
| 288 | − | |
| 289 | − _lightmapNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 290 | − PathUtils::resourcesPath() + "shaders/model_lightmap_normal_map.vert"); | |
| 291 | − _lightmapNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 292 | − PathUtils::resourcesPath() + "shaders/model_lightmap_normal_specular_map.frag"); | |
| 293 | − | |
| 294 | − initProgram(_lightmapNormalSpecularMapProgram, _lightmapNormalSpecularMapLocations); | |
| 295 | − // end lightmap | |
| 296 | − | |
| 297 | − | |
| 298 | − _shadowProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/model_shadow.vert"); | |
| 299 | − _shadowProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 300 | − PathUtils::resourcesPath() + "shaders/model_shadow.frag"); | |
| 301 | − | |
| 302 | − _skinProgram.addShaderFromSourceFile(QGLShader::Vertex, PathUtils::resourcesPath() + "shaders/skin_model.vert"); | |
| 303 | − _skinProgram.addShaderFromSourceCode(QGLShader::Fragment, model_frag); | |
| 304 | − | |
| 305 | − initSkinProgram(_skinProgram, _skinLocations); | |
| 306 | − | |
| 307 | − _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 308 | − PathUtils::resourcesPath() + "shaders/skin_model_normal_map.vert"); | |
| 309 | − _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 310 | − PathUtils::resourcesPath() + "shaders/model_normal_map.frag"); | |
| 311 | − | |
| 312 | − initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations); | |
| 313 | − | |
| 314 | − _skinSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 315 | − PathUtils::resourcesPath() + "shaders/skin_model.vert"); | |
| 316 | − _skinSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 317 | − PathUtils::resourcesPath() + "shaders/model_specular_map.frag"); | |
| 318 | − | |
| 319 | − initSkinProgram(_skinSpecularMapProgram, _skinSpecularMapLocations); | |
| 320 | − | |
| 321 | − _skinNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 322 | − PathUtils::resourcesPath() + "shaders/skin_model_normal_map.vert"); | |
| 323 | − _skinNormalSpecularMapProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 324 | − PathUtils::resourcesPath() + "shaders/model_normal_specular_map.frag"); | |
| 325 | − | |
| 326 | − initSkinProgram(_skinNormalSpecularMapProgram, _skinNormalSpecularMapLocations); | |
| 327 | − | |
| 328 | − _skinShadowProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 329 | − PathUtils::resourcesPath() + "shaders/skin_model_shadow.vert"); | |
| 330 | − _skinShadowProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 331 | − PathUtils::resourcesPath() + "shaders/model_shadow.frag"); | |
| 332 | − | |
| 333 | − initSkinProgram(_skinShadowProgram, _skinShadowLocations); | |
| 334 | − | |
| 335 | − _skinTranslucentProgram.addShaderFromSourceFile(QGLShader::Vertex, | |
| 336 | − PathUtils::resourcesPath() + "shaders/skin_model.vert"); | |
| 337 | − _skinTranslucentProgram.addShaderFromSourceFile(QGLShader::Fragment, | |
| 338 | − PathUtils::resourcesPath() + "shaders/model_translucent.frag"); | |
| 339 | − | |
| 260 | + _normalMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_normal_map_vert); | |
| 261 | + _normalMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_normal_map_frag); | |
| 262 | + initProgram(_normalMapProgram, _normalMapLocations); | |
| 263 | + | |
| 264 | + _specularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_vert); | |
| 265 | + _specularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_specular_map_frag); | |
| 266 | + initProgram(_specularMapProgram, _specularMapLocations); | |
| 267 | + | |
| 268 | + _normalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_normal_map_vert); | |
| 269 | + _normalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_normal_specular_map_frag); | |
| 270 | + initProgram(_normalSpecularMapProgram, _normalSpecularMapLocations); | |
| 271 | + | |
| 272 | + _translucentProgram.addShaderFromSourceCode(QGLShader::Vertex, model_vert); | |
| 273 | + _translucentProgram.addShaderFromSourceCode(QGLShader::Fragment, model_translucent_frag); | |
| 274 | + initProgram(_translucentProgram, _translucentLocations); | |
| 275 | + | |
| 276 | + // Lightmap | |
| 277 | + _lightmapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_lightmap_vert); | |
| 278 | + _lightmapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_lightmap_frag); | |
| 279 | + initProgram(_lightmapProgram, _lightmapLocations); | |
| 280 | + | |
| 281 | + _lightmapNormalMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_lightmap_normal_map_vert); | |
| 282 | + _lightmapNormalMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_lightmap_normal_map_frag); | |
| 283 | + initProgram(_lightmapNormalMapProgram, _lightmapNormalMapLocations); | |
| 284 | + | |
| 285 | + _lightmapSpecularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_lightmap_vert); | |
| 286 | + _lightmapSpecularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_lightmap_specular_map_frag); | |
| 287 | + initProgram(_lightmapSpecularMapProgram, _lightmapSpecularMapLocations); | |
| 288 | + | |
| 289 | + _lightmapNormalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_lightmap_normal_map_vert); | |
| 290 | + _lightmapNormalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_lightmap_normal_specular_map_frag); | |
| 291 | + initProgram(_lightmapNormalSpecularMapProgram, _lightmapNormalSpecularMapLocations); | |
| 292 | + // end lightmap | |
| 293 | + | |
| 294 | + | |
| 295 | + _shadowProgram.addShaderFromSourceCode(QGLShader::Vertex, model_shadow_vert); | |
| 296 | + _shadowProgram.addShaderFromSourceCode(QGLShader::Fragment, model_shadow_frag); | |
| 297 | + | |
| 298 | + _skinProgram.addShaderFromSourceCode(QGLShader::Vertex, skin_model_vert); | |
| 299 | + _skinProgram.addShaderFromSourceCode(QGLShader::Fragment, model_frag); | |
| 300 | + initSkinProgram(_skinProgram, _skinLocations); | |
| 301 | + | |
| 302 | + _skinNormalMapProgram.addShaderFromSourceCode(QGLShader::Vertex, skin_model_normal_map_vert); | |
| 303 | + _skinNormalMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_normal_map_frag); | |
| 304 | + initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations); | |
| 305 | + | |
| 306 | + _skinSpecularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, model_vert); | |
| 307 | + _skinSpecularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_specular_map_frag); | |
| 308 | + initSkinProgram(_skinSpecularMapProgram, _skinSpecularMapLocations); | |
| 309 | + | |
| 310 | + _skinNormalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Vertex, skin_model_normal_map_vert); | |
| 311 | + _skinNormalSpecularMapProgram.addShaderFromSourceCode(QGLShader::Fragment, model_normal_specular_map_frag); | |
| 312 | + initSkinProgram(_skinNormalSpecularMapProgram, _skinNormalSpecularMapLocations); | |
| 313 | + | |
| 314 | + _skinShadowProgram.addShaderFromSourceCode(QGLShader::Vertex, skin_model_shadow_vert); | |
| 315 | + _skinShadowProgram.addShaderFromSourceCode(QGLShader::Fragment, model_shadow_frag); | |
| 316 | + initSkinProgram(_skinShadowProgram, _skinShadowLocations); | |
| 317 | + | |
| 318 | + | |
| 319 | + _skinTranslucentProgram.addShaderFromSourceCode(QGLShader::Vertex, skin_model_vert); | |
| 320 | + _skinTranslucentProgram.addShaderFromSourceCode(QGLShader::Fragment, model_translucent_frag); | |
| 340 | 321 | initSkinProgram(_skinTranslucentProgram, _skinTranslucentLocations); |
| 341 | 322 | } |
| 342 | 323 | } |