在shader中访问顶点法相
前提条件:使用cesium内部的geometry,非自定义的geometry,比如BoxGeometry。

构造Geometry时,需要指定vertexFormat里面包含NORMAL,这样在构造Geometry时,Cesium会自动生成顶点法向。在默认情况下,Cesium开启了数据压缩,将Float32类型的数据压缩。如在BoxGeometry构造时,vertexFormat设置为POSITION_AND_NORMAL后,创建Box时,会自动将生成的normal压缩为一个Float,对应shader里面的attribute为compressedAttributes,当仅有法向时,compressedAttributes为float类型,在shader中可以通过解压来直接得到顶点法向。
out vec3 v_normal;
...
// get normal of vertex
v_normal=czm_octDecode(compressedAttributes);



















![C# [unity]求顶点数量不等的两条曲线的中线](https://img-blog.csdnimg.cn/f089b174233f455c84408f82ba4f728e.jpeg)