当父节点设置stateset之后,子节点设置stateset还管用吗
时间: 2024-04-05 15:33:07 浏览: 18
当父节点设置stateset之后,子节点设置stateset仍然管用。但是,子节点的stateset会与父节点的stateset合并,形成一个新的stateset,并且子节点的stateset会覆盖父节点相同状态位上的设置。因此,子节点的stateset可以在保留父节点设置的同时,对一些状态进行自定义设置。
相关问题
当父节点stateset设置为osg::StateAttribute::OVERRIDE之后,子节点设置stateset还管用吗
当父节点的stateset设置为osg::StateAttribute::OVERRIDE时,子节点设置的stateset不再管用。因为当父节点的stateset设置为OVERRIDE时,它将覆盖所有子节点的stateset设置。此时,子节点设置的stateset将被忽略,只有父节点的stateset起作用。所以,如果你需要在子节点中设置stateset,请确保父节点的stateset没有设置为OVERRIDE。
当父节点设置为state->setDataVariance(osg::Object::STATIC);,子节点设置stateset还管用吗
当父节点的setDataVariance设置为osg::Object::STATIC时,子节点设置的stateset仍然管用。因为setDataVariance方法只是告诉OSG对象该如何处理对象的数据变化,具体来说,STATIC表示该对象的数据不会改变,所以OSG可以对该对象进行一些优化,例如共享数据等。但是,这并不会影响到子节点的stateset设置,因为stateset与数据变化是没有必然联系的。所以,无论父节点的setDataVariance设置为何值,子节点的stateset设置都会被保留。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)