ModelExperimentalVS.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "precision highp float;\n\
  3. \n\
  4. czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\n\
  5. czm_modelVertexOutput vsOutput;\n\
  6. vsOutput.positionMC = positionMC;\n\
  7. vsOutput.pointSize = 1.0;\n\
  8. return vsOutput;\n\
  9. }\n\
  10. \n\
  11. void main() \n\
  12. {\n\
  13. // Initialize the attributes struct with all\n\
  14. // attributes except quantized ones.\n\
  15. ProcessedAttributes attributes;\n\
  16. initializeAttributes(attributes);\n\
  17. \n\
  18. // Dequantize the quantized ones and add them to the\n\
  19. // attributes struct.\n\
  20. #ifdef USE_DEQUANTIZATION\n\
  21. dequantizationStage(attributes);\n\
  22. #endif\n\
  23. \n\
  24. #ifdef HAS_MORPH_TARGETS\n\
  25. morphTargetsStage(attributes);\n\
  26. #endif\n\
  27. \n\
  28. #ifdef HAS_SKINNING\n\
  29. skinningStage(attributes);\n\
  30. #endif\n\
  31. \n\
  32. // Compute the bitangent according to the formula in the glTF spec.\n\
  33. // Normal and tangents can be affected by morphing and skinning, so\n\
  34. // the bitangent should not be computed until their values are finalized.\n\
  35. #ifdef HAS_BITANGENTS\n\
  36. attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);\n\
  37. #endif\n\
  38. \n\
  39. FeatureIds featureIds;\n\
  40. featureIdStage(featureIds, attributes);\n\
  41. \n\
  42. #ifdef HAS_SELECTED_FEATURE_ID\n\
  43. SelectedFeature feature;\n\
  44. selectedFeatureIdStage(feature, featureIds);\n\
  45. cpuStylingStage(attributes.positionMC, feature);\n\
  46. #endif\n\
  47. \n\
  48. mat4 modelView = czm_modelView;\n\
  49. mat3 normal = czm_normal;\n\
  50. \n\
  51. // Update the position for this instance in place\n\
  52. #ifdef HAS_INSTANCING\n\
  53. \n\
  54. // The legacy instance stage is used when rendering I3DM models that \n\
  55. // encode instances transforms in world space, as opposed to glTF models\n\
  56. // that use EXT_mesh_gpu_instancing, where instance transforms are encoded\n\
  57. // in object space.\n\
  58. #ifdef USE_LEGACY_INSTANCING\n\
  59. mat4 instanceModelView;\n\
  60. mat3 instanceModelViewInverseTranspose;\n\
  61. \n\
  62. legacyInstancingStage(attributes.positionMC, instanceModelView, instanceModelViewInverseTranspose);\n\
  63. \n\
  64. modelView = instanceModelView;\n\
  65. normal = instanceModelViewInverseTranspose;\n\
  66. #else\n\
  67. instancingStage(attributes.positionMC);\n\
  68. #endif\n\
  69. \n\
  70. #ifdef USE_PICKING\n\
  71. v_pickColor = a_pickColor;\n\
  72. #endif\n\
  73. \n\
  74. #endif\n\
  75. \n\
  76. Metadata metadata;\n\
  77. metadataStage(metadata, attributes);\n\
  78. \n\
  79. #ifdef HAS_CUSTOM_VERTEX_SHADER\n\
  80. czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\n\
  81. customShaderStage(vsOutput, attributes, featureIds, metadata);\n\
  82. #endif\n\
  83. \n\
  84. // Compute the final position in each coordinate system needed.\n\
  85. // This also sets gl_Position.\n\
  86. geometryStage(attributes, modelView, normal); \n\
  87. \n\
  88. #ifdef PRIMITIVE_TYPE_POINTS\n\
  89. #ifdef HAS_CUSTOM_VERTEX_SHADER\n\
  90. gl_PointSize = vsOutput.pointSize;\n\
  91. #elif defined(USE_POINT_CLOUD_ATTENUATION)\n\
  92. gl_PointSize = pointCloudAttenuationStage(v_positionEC);\n\
  93. #else\n\
  94. gl_PointSize = 1.0;\n\
  95. #endif\n\
  96. #endif\n\
  97. }\n\
  98. ";