Permalink
Browse files

Fix autosprite2 shaders.

  • Loading branch information...
gimhael committed Feb 18, 2016
1 parent 12cd044 commit f150b90154922a49c7e1bbccaa16db37b6462c33
Showing with 106 additions and 144 deletions.
  1. +86 −85 daemon/src/engine/renderer/shaders.cpp
  2. +19 −58 daemon/src/engine/renderer/tr_shade_calc.cpp
  3. +1 −1 main/glsl/vertexSprite_vp.glsl
@@ -21984,91 +21984,92 @@ const char vertexSprite_vp[] = {
0x20, 0x26, 0x20, 0x63, 0x6f, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x6f,
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x61, 0x63, 0x74, 0x6f,
0x72, 0x0a, 0x0a, 0x09, 0x63, 0x6f, 0x72, 0x6e, 0x65, 0x72, 0x20, 0x3d,
0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f,
0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30,
0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x0a, 0x09, 0x69, 0x66,
0x28, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x3c, 0x3d, 0x20,
0x30, 0x2e, 0x30, 0x20, 0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x2f, 0x2f,
0x20, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x70, 0x72, 0x69, 0x74, 0x65, 0x32,
0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f,
0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x78, 0x79, 0x7a, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73,
0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x70, 0x2d, 0x76, 0x65, 0x63, 0x74,
0x6f, 0x72, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x20, 0x3d, 0x20, 0x61, 0x74,
0x74, 0x72, 0x5f, 0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x09, 0x09, 0x6c, 0x65,
0x66, 0x74, 0x20, 0x3d, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20,
0x2a, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28,
0x20, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x28, 0x20, 0x75, 0x70, 0x2c, 0x20,
0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a,
0x09, 0x09, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d,
0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2b, 0x20, 0x63,
0x6f, 0x72, 0x6e, 0x65, 0x72, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x6c, 0x65,
0x66, 0x74, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x29, 0x3b, 0x0a, 0x09,
0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x2f,
0x2f, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x73, 0x70, 0x72, 0x69, 0x74, 0x65,
0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f,
0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x78, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20,
0x61, 0x6e, 0x67, 0x6c, 0x65, 0x0a, 0x09, 0x09, 0x6c, 0x65, 0x66, 0x74,
0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65,
0x28, 0x20, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x28, 0x20, 0x75, 0x5f, 0x56,
0x69, 0x65, 0x77, 0x55, 0x70, 0x2c, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61,
0x6c, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x20,
0x3d, 0x20, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x28, 0x20, 0x6c, 0x65, 0x66,
0x74, 0x2c, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x29, 0x3b,
0x0a, 0x0a, 0x09, 0x09, 0x73, 0x20, 0x3d, 0x20, 0x72, 0x61, 0x64, 0x69,
0x75, 0x73, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x20, 0x72, 0x61,
0x64, 0x69, 0x61, 0x6e, 0x73, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f,
0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x78, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x63, 0x20, 0x3d,
0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x2a, 0x20, 0x63, 0x6f,
0x73, 0x28, 0x20, 0x72, 0x61, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x28, 0x20,
0x61, 0x74, 0x74, 0x72, 0x5f, 0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a,
0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65,
0x20, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x70,
0x20, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x0a, 0x09, 0x09, 0x76,
0x65, 0x63, 0x33, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x4f, 0x72, 0x69, 0x67,
0x20, 0x3d, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x3b, 0x0a, 0x09, 0x09, 0x6c,
0x65, 0x66, 0x74, 0x20, 0x3d, 0x20, 0x63, 0x20, 0x2a, 0x20, 0x6c, 0x65,
0x66, 0x74, 0x20, 0x2b, 0x20, 0x73, 0x20, 0x2a, 0x20, 0x75, 0x70, 0x3b,
0x0a, 0x09, 0x09, 0x75, 0x70, 0x20, 0x3d, 0x20, 0x63, 0x20, 0x2a, 0x20,
0x75, 0x70, 0x20, 0x2d, 0x20, 0x73, 0x20, 0x2a, 0x20, 0x6c, 0x65, 0x66,
0x74, 0x4f, 0x72, 0x69, 0x67, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x6c, 0x65,
0x66, 0x74, 0x20, 0x2a, 0x3d, 0x20, 0x63, 0x6f, 0x72, 0x6e, 0x65, 0x72,
0x2e, 0x78, 0x3b, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x20, 0x2a, 0x3d, 0x20,
0x63, 0x6f, 0x72, 0x6e, 0x65, 0x72, 0x2e, 0x79, 0x3b, 0x0a, 0x0a, 0x09,
0x09, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20,
0x76, 0x65, 0x63, 0x34, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2b, 0x20, 0x6c, 0x65,
0x66, 0x74, 0x20, 0x2b, 0x20, 0x75, 0x70, 0x2c, 0x20, 0x31, 0x2e, 0x30,
0x20, 0x29, 0x3b, 0x0a, 0x09, 0x7d, 0x0a, 0x09, 0x6e, 0x6f, 0x72, 0x6d,
0x61, 0x6c, 0x42, 0x61, 0x73, 0x69, 0x73, 0x2e, 0x6e, 0x6f, 0x72, 0x6d,
0x61, 0x6c, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b,
0x0a, 0x23, 0x69, 0x66, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64,
0x28, 0x55, 0x53, 0x45, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5f,
0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x29, 0x0a, 0x09, 0x6e, 0x6f,
0x72, 0x6d, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x69, 0x73, 0x2e, 0x74, 0x61,
0x6e, 0x67, 0x65, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x72, 0x6d,
0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x20, 0x75, 0x70, 0x20, 0x29, 0x3b,
0x0a, 0x09, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x69,
0x73, 0x2e, 0x62, 0x69, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d,
0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x20,
0x6c, 0x65, 0x66, 0x74, 0x20, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64,
0x69, 0x66, 0x0a, 0x09, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64,
0x20, 0x3d, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x54, 0x65, 0x78, 0x43,
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x09, 0x6c,
0x6d, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x20, 0x20, 0x3d, 0x20, 0x61, 0x74,
0x74, 0x72, 0x5f, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x30,
0x2e, 0x7a, 0x77, 0x3b, 0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x20,
0x20, 0x20, 0x20, 0x3d, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x43, 0x6f,
0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x0a, 0x09, 0x75, 0x5f, 0x44, 0x65, 0x70,
0x74, 0x68, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x2e,
0x30, 0x20, 0x2a, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a,
0x7d, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, 0x66, 0x0a, 0x00
0x20, 0x73, 0x69, 0x67, 0x6e, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f,
0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79,
0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30,
0x20, 0x29, 0x3b, 0x0a, 0x0a, 0x09, 0x69, 0x66, 0x28, 0x20, 0x72, 0x61,
0x64, 0x69, 0x75, 0x73, 0x20, 0x3c, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x20,
0x29, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x61, 0x75, 0x74,
0x6f, 0x73, 0x70, 0x72, 0x69, 0x74, 0x65, 0x32, 0x20, 0x6d, 0x6f, 0x64,
0x65, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x4f, 0x72, 0x69, 0x65,
0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x7a, 0x20,
0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65,
0x20, 0x75, 0x70, 0x2d, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0a, 0x09,
0x09, 0x75, 0x70, 0x20, 0x3d, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x4f,
0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78,
0x79, 0x7a, 0x3b, 0x0a, 0x09, 0x09, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x3d,
0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x2a, 0x20, 0x6e, 0x6f,
0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x20, 0x63, 0x72, 0x6f,
0x73, 0x73, 0x28, 0x20, 0x75, 0x70, 0x2c, 0x20, 0x6e, 0x6f, 0x72, 0x6d,
0x61, 0x6c, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x09, 0x70, 0x6f,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63,
0x34, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x50, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2b, 0x20, 0x63, 0x6f, 0x72, 0x6e, 0x65,
0x72, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x2c, 0x20,
0x31, 0x2e, 0x30, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x7d, 0x20, 0x65, 0x6c,
0x73, 0x65, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x2f, 0x2f, 0x20, 0x61, 0x75,
0x74, 0x6f, 0x73, 0x70, 0x72, 0x69, 0x74, 0x65, 0x20, 0x6d, 0x6f, 0x64,
0x65, 0x2c, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x4f, 0x72, 0x69, 0x65,
0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x20, 0x63, 0x6f,
0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x67, 0x6c,
0x65, 0x0a, 0x09, 0x09, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x3d, 0x20, 0x6e,
0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x20, 0x63, 0x72,
0x6f, 0x73, 0x73, 0x28, 0x20, 0x75, 0x5f, 0x56, 0x69, 0x65, 0x77, 0x55,
0x70, 0x2c, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x29, 0x20,
0x29, 0x3b, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x20, 0x3d, 0x20, 0x63, 0x72,
0x6f, 0x73, 0x73, 0x28, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x2c, 0x20, 0x6e,
0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x29, 0x3b, 0x0a, 0x0a, 0x09, 0x09,
0x73, 0x20, 0x3d, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x2a,
0x20, 0x73, 0x69, 0x6e, 0x28, 0x20, 0x72, 0x61, 0x64, 0x69, 0x61, 0x6e,
0x73, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x4f, 0x72, 0x69, 0x65,
0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x20, 0x29, 0x20,
0x29, 0x3b, 0x0a, 0x09, 0x09, 0x63, 0x20, 0x3d, 0x20, 0x72, 0x61, 0x64,
0x69, 0x75, 0x73, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x20, 0x72,
0x61, 0x64, 0x69, 0x61, 0x6e, 0x73, 0x28, 0x20, 0x61, 0x74, 0x74, 0x72,
0x5f, 0x4f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2e, 0x78, 0x20, 0x29, 0x20, 0x29, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x2f,
0x2f, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x20, 0x6c, 0x65, 0x66,
0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x70, 0x20, 0x76, 0x65, 0x63,
0x74, 0x6f, 0x72, 0x73, 0x0a, 0x09, 0x09, 0x76, 0x65, 0x63, 0x33, 0x20,
0x6c, 0x65, 0x66, 0x74, 0x4f, 0x72, 0x69, 0x67, 0x20, 0x3d, 0x20, 0x6c,
0x65, 0x66, 0x74, 0x3b, 0x0a, 0x09, 0x09, 0x6c, 0x65, 0x66, 0x74, 0x20,
0x3d, 0x20, 0x63, 0x20, 0x2a, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x2b,
0x20, 0x73, 0x20, 0x2a, 0x20, 0x75, 0x70, 0x3b, 0x0a, 0x09, 0x09, 0x75,
0x70, 0x20, 0x3d, 0x20, 0x63, 0x20, 0x2a, 0x20, 0x75, 0x70, 0x20, 0x2d,
0x20, 0x73, 0x20, 0x2a, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x4f, 0x72, 0x69,
0x67, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x2a,
0x3d, 0x20, 0x63, 0x6f, 0x72, 0x6e, 0x65, 0x72, 0x2e, 0x78, 0x3b, 0x0a,
0x09, 0x09, 0x75, 0x70, 0x20, 0x2a, 0x3d, 0x20, 0x63, 0x6f, 0x72, 0x6e,
0x65, 0x72, 0x2e, 0x79, 0x3b, 0x0a, 0x0a, 0x09, 0x09, 0x70, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34,
0x28, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x20, 0x2b, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20, 0x2b,
0x20, 0x75, 0x70, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x20, 0x29, 0x3b, 0x0a,
0x09, 0x7d, 0x0a, 0x09, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x42, 0x61,
0x73, 0x69, 0x73, 0x2e, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d,
0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x23, 0x69, 0x66,
0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x28, 0x55, 0x53, 0x45,
0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x5f, 0x4d, 0x41, 0x50, 0x50,
0x49, 0x4e, 0x47, 0x29, 0x0a, 0x09, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c,
0x42, 0x61, 0x73, 0x69, 0x73, 0x2e, 0x74, 0x61, 0x6e, 0x67, 0x65, 0x6e,
0x74, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a,
0x65, 0x28, 0x20, 0x75, 0x70, 0x20, 0x29, 0x3b, 0x0a, 0x09, 0x6e, 0x6f,
0x72, 0x6d, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x69, 0x73, 0x2e, 0x62, 0x69,
0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x6e, 0x6f, 0x72,
0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x20, 0x6c, 0x65, 0x66, 0x74,
0x20, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, 0x66, 0x0a, 0x09,
0x74, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x20, 0x3d, 0x20, 0x61,
0x74, 0x74, 0x72, 0x5f, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64,
0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x09, 0x6c, 0x6d, 0x43, 0x6f, 0x6f,
0x72, 0x64, 0x20, 0x20, 0x3d, 0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x54,
0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x7a, 0x77, 0x3b,
0x0a, 0x09, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x20, 0x20, 0x20, 0x3d,
0x20, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b,
0x0a, 0x0a, 0x09, 0x75, 0x5f, 0x44, 0x65, 0x70, 0x74, 0x68, 0x53, 0x63,
0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20,
0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x7d, 0x0a, 0x23, 0x65,
0x6e, 0x64, 0x69, 0x66, 0x0a, 0x00
};
const char volumetricFog_fp[] = {
0x2f, 0x2a, 0x0a, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
@@ -467,50 +467,6 @@ DEFORMATIONS
====================================================================
*/
/*
=====================
ReorderQuadVerts
Reorder the quad vertices so that they are sorted by their texcoords
=====================
*/
static void ReorderQuadVerts( shaderVertex_t *vert, glIndex_t *index,
glIndex_t minIndex )
{
int newIndex[4];
shaderVertex_t vertexCopy[4];
vec2_t midTexCoord;
int i;
Com_Memcpy( vertexCopy, vert, 4 * sizeof(shaderVertex_t) );
midTexCoord[ 0 ] = midTexCoord[ 1 ] = 0.0f;
for( i = 0; i < 4; i++ ) {
midTexCoord[ 0 ] += halfToFloat( vert[ i ].texCoords[ 0 ] );
midTexCoord[ 1 ] += halfToFloat( vert[ i ].texCoords[ 1 ] );
}
midTexCoord[ 0 ] *= 0.25f;
midTexCoord[ 1 ] *= 0.25f;
for( i = 0; i < 4; i++ ) {
newIndex[ i ] = 0;
if( halfToFloat( vert[ i ].texCoords[ 0 ] ) > midTexCoord[ 0 ] )
newIndex[ i ] |= 3;
if( halfToFloat( vert[ i ].texCoords[ 1 ] ) > midTexCoord[ 1 ] )
newIndex[ i ] ^= 1;
newIndex[ i ] = (newIndex[ i ] - minIndex) & 3;
}
for( i = 0; i < 4; i++ ) {
Com_Memcpy( &vert[ newIndex[ i ] ], &vertexCopy[ i ],
sizeof(shaderVertex_t) );
}
for( i = 0; i < 6; i++ ) {
index[ i ] = minIndex + newIndex[ index[ i ] - minIndex ];
}
}
/*
=====================
AutospriteDeform
@@ -574,10 +530,11 @@ static const int edgeVerts[ 6 ][ 2 ] =
{ 2, 3 }
};
static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex, int numIndexes )
static void Autosprite2Deform( int firstVertex, int numVertexes, int numIndexes )
{
shaderVertex_t *v = &tess.verts[ firstVertex ];
int i, j, k;
int indexes;
vec3_t oldPos[4];
if ( numVertexes & 3 )
{
@@ -592,7 +549,7 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
// this is a lot of work for two triangles...
// we could precalculate a lot of it is an issue, but it would mess up
// the shader abstraction
for ( i = 0, indexes = 0; i < numVertexes; i += 4, indexes += 6 )
for ( i = 0; i < numVertexes; i += 4, v += 4 )
{
float lengths[ 2 ];
int nums[ 2 ];
@@ -601,10 +558,12 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
vec3_t major, minor;
shaderVertex_t *v1, *v2;
ReorderQuadVerts( tess.verts + firstVertex + i,
tess.indexes + firstIndex + indexes,
firstVertex );
R_QtangentsToNormal( tess.verts[ firstVertex + i ].qtangents, normal );
VectorCopy( v[0].xyz, oldPos[0] );
VectorCopy( v[1].xyz, oldPos[1] );
VectorCopy( v[2].xyz, oldPos[2] );
VectorCopy( v[3].xyz, oldPos[3] );
R_QtangentsToNormal( v->qtangents, normal );
// find the midpoint
@@ -617,8 +576,8 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
float l;
vec3_t temp;
v1 = tess.verts + firstVertex + i + edgeVerts[ j ][ 0 ];
v2 = tess.verts + firstVertex + i + edgeVerts[ j ][ 1 ];
v1 = v + edgeVerts[ j ][ 0 ];
v2 = v + edgeVerts[ j ][ 1 ];
VectorSubtract( v1->xyz, v2->xyz, temp );
@@ -640,8 +599,8 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
for ( j = 0; j < 2; j++ )
{
v1 = tess.verts + firstVertex + i + edgeVerts[ nums[ j ] ][ 0 ];
v2 = tess.verts + firstVertex + i + edgeVerts[ nums[ j ] ][ 1 ];
v1 = v + edgeVerts[ nums[ j ] ][ 0 ];
v2 = v + edgeVerts[ nums[ j ] ][ 1 ];
mid[ j ][ 0 ] = 0.5f * ( v1->xyz[ 0 ] + v2->xyz[ 0 ] );
mid[ j ][ 1 ] = 0.5f * ( v1->xyz[ 1 ] + v2->xyz[ 1 ] );
@@ -657,7 +616,7 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
{
vec4_t orientation;
v1 = &tess.verts[ firstVertex + i + j ];
v1 = v + j;
lengths[ 0 ] = Distance( mid[ 0 ], v1->xyz );
lengths[ 1 ] = Distance( mid[ 1 ], v1->xyz );
@@ -668,7 +627,7 @@ static void Autosprite2Deform( int firstVertex, int numVertexes, int firstIndex,
k = 1;
VectorSubtract( v1->xyz, mid[ k ], minor );
if ( DotProduct( cross, minor ) * (k ? -1.0f : 1.0f) < 0.0f ) {
if ( DotProduct( cross, minor ) * ( halfToFloat( v1->texCoords[ 1 ] ) - 0.5f ) < 0.0f ) {
VectorNegate( major, orientation );
} else {
VectorCopy( major, orientation );
@@ -689,12 +648,14 @@ Tess_AutospriteDeform
void Tess_AutospriteDeform( int mode, int firstVertex, int numVertexes,
int firstIndex, int numIndexes )
{
(void)firstIndex;
switch( mode ) {
case 1:
AutospriteDeform( firstVertex, numVertexes, numIndexes );
break;
case 2:
Autosprite2Deform( firstVertex, numVertexes, firstIndex, numIndexes );
Autosprite2Deform( firstVertex, numVertexes, numIndexes );
break;
}
GL_CheckErrors();
@@ -44,7 +44,7 @@ void VertexFetch(out vec4 position,
vec3 normal = normalize( u_ViewOrigin - attr_Position ), up, left;
float s, c; // sin & cos of rotation factor
corner = attr_TexCoord0.xy * 2.0 - 1.0;
corner = sign( attr_TexCoord0.xy * 2.0 - 1.0 );
if( radius <= 0.0 ) {
// autosprite2 mode, attr_Orientation.xyz contains the up-vector

0 comments on commit f150b90

Please sign in to comment.