2
0
Эх сурвалжийг харах

shader: Fix p3d_LightSource being in view instead of apiview space

rdb 1 жил өмнө
parent
commit
3b78d948e3

+ 3 - 3
panda/src/display/shaderInputBinding_impls.cxx

@@ -1399,7 +1399,7 @@ ShaderLightStructBinding(const ShaderType *type, const InternalName *input) {
 int ShaderLightStructBinding::
 get_state_dep() const {
   int dep = Shader::D_frame |
-            Shader::get_matrix_deps(Shader::SM_world_to_view) |
+            Shader::get_matrix_deps(Shader::SM_world_to_apiview) |
             Shader::get_matrix_deps(Shader::SM_apiview_to_world);
   if (_input != nullptr) {
     return Shader::D_shader_inputs | dep;
@@ -1414,7 +1414,7 @@ get_state_dep() const {
  */
 void ShaderLightStructBinding::
 setup(Shader *shader) {
-  _world_to_view_mat_cache_index = shader->add_matrix_cache_item(Shader::SM_world_to_view, nullptr, Shader::get_matrix_deps(Shader::SM_world_to_view));
+  _world_to_apiview_mat_cache_index = shader->add_matrix_cache_item(Shader::SM_world_to_apiview, nullptr, Shader::get_matrix_deps(Shader::SM_world_to_apiview));
   _apiview_to_world_mat_cache_index = shader->add_matrix_cache_item(Shader::SM_apiview_to_world, nullptr, Shader::get_matrix_deps(Shader::SM_apiview_to_world));
 }
 
@@ -1502,7 +1502,7 @@ fetch_light(const State &state, const NodePath &np, void *into) const {
 
       CPT(TransformState) net_transform = np.get_net_transform();
       LMatrix4 mat = net_transform->get_mat() *
-        state.matrix_cache[_world_to_view_mat_cache_index];
+        state.matrix_cache[_world_to_apiview_mat_cache_index];
 
       LightLensNode *light;
       DCAST_INTO_V(light, node);

+ 1 - 1
panda/src/display/shaderInputBinding_impls.h

@@ -178,7 +178,7 @@ protected:
   CPT(InternalName) _input;
   size_t _count;
   size_t _stride;
-  size_t _world_to_view_mat_cache_index;
+  size_t _world_to_apiview_mat_cache_index;
   size_t _apiview_to_world_mat_cache_index;
   bool _cube_shadow_map = false;
   int _color_offset = -1;