cesium中对于 gltf1.0、2.0中某些扩展需要进行解析,解析的过程是将gltf1.0的格式转换成gltf2.0的格式。
        对于解析过程中使用的某些扩展的解释:


{"asset": {"version": "2.0"},"scene": 0,"scenes": [{"nodes": [0]}],"nodes": [{"children": [2,1],"matrix": [0.009999999776482582,0.0,0.0,0.0,0.0,0.009999999776482582,0.0,0.0,0.0,0.0,0.009999999776482582,0.0,0.0,0.0,0.0,1.0]},{"matrix": [-0.7289686799049377,0.0,-0.6845470666885376,0.0,-0.4252049028873444,0.7836934328079224,0.4527972936630249,0.0,0.5364750623703003,0.6211478114128113,-0.571287989616394,0.0,400.1130065917969,463.2640075683594,-431.0780334472656,1.0],"camera": 0},{"mesh": 0}],"cameras": [{"perspective": {"aspectRatio": 1.5,"yfov": 0.6605925559997559,"zfar": 10000.0,"znear": 1.0},"type": "perspective"}],"meshes": [{"primitives": [{"attributes": {"NORMAL": 1,"POSITION": 2,"TEXCOORD_0": 3,"_CUSTOM_ATTRIBUTE": 4},"indices": 0,"mode": 4,"material": 0}],"name": "LOD3spShape"}],"accessors": [{"bufferView": 0,"byteOffset": 0,"componentType": 5123,"count": 12636,"max": [2398],"min": [0],"type": "SCALAR"},{"bufferView": 1,"byteOffset": 0,"componentType": 5126,"count": 2399,"max": [0.9995989799499512,0.999580979347229,0.9984359741210938],"min": [-0.9990839958190918,-1.0,-0.9998319745063782],"type": "VEC3"},{"bufferView": 1,"byteOffset": 28788,"componentType": 5126,"count": 2399,"max": [96.17990112304688,163.97000122070313,53.92519760131836],"min": [-69.29850006103516,9.929369926452637,-61.32819747924805],"type": "VEC3"},{"bufferView": 2,"byteOffset": 0,"componentType": 5126,"count": 2399,"max": [0.9833459854125976,0.9800369739532472],"min": [0.026409000158309938,0.01996302604675293],"type": "VEC2"},{"bufferView": 3,"byteOffset": 0,"componentType": 5125,"count": 2399,"type": "SCALAR"}],"materials": [{"extensions": {"KHR_techniques_webgl": {"technique": 0,"values" : {"u_shininess": 10.0,"u_light0Color": [0.8,0.8,1.0],"u_ambient": [0.1,0.1,0.1,1.0]}}}}],"textures": [{"sampler": 0,"source": 0}],"images": [{"uri": "DuckCM.png"}],"extensions": {"KHR_techniques_webgl": {"programs": [{"fragmentShader": 0,"vertexShader": 1}],"shaders": [{"type": 35632,"uri": "duck0FS.glsl"},{"type": 35633,"uri": "duck0VS.glsl"}],"techniques": [{"program": 0,"attributes": {"a_normal":  {"semantic": "NORMAL"},"a_position": {"semantic": "POSITION"},"a_texcoord0": {"semantic": "TEXCOORD_0"},"a_custom": {"semantic": "_CUSTOM_ATTRIBUTE"}},"uniforms": {"u_ambient": {"type": 35666},"u_diffuse": {"type": 35678,"value": {"index": 0}},"u_shininess": {"type": 5126},"u_light0Color": {"type": 35665,"value": [1,1,1]},"u_light0Transform": {"semantic": "MODEL","node": 1,"type": 35676},"u_modelViewMatrix": {"semantic": "MODELVIEW","type": 35676},"u_normalMatrix": {"semantic": "MODELVIEWINVERSETRANSPOSE","type": 35675},"u_projectionMatrix": {"semantic": "PROJECTION","type": 35676}}}]}},"extensionsRequired": ["KHR_techniques_webgl"],"extensionsUsed": ["KHR_techniques_webgl"]
}

使用的扩展需要在    extensionsRequired、extensionsUsed中进行声明。

 "materials": [{"extensions": {"KHR_techniques_webgl": {"technique": 0,"values" : {"u_shininess": 10.0,"u_light0Color": [0.8,0.8,1.0],"u_ambient": [0.1,0.1,0.1,1.0]}}}}],

上面的格式中某个mesh使用了材质扩展一些效果,使用了KHR_techniques_webgl扩展,这个扩展定义了technique是一个引用,真正的数据在"extensions":"KHR_techniques_webgl":"techniques":中。

而如果materials中的technique不是一个索引,是一个光照模型,就比较清楚materials中的扩展的values是什么了,technique可以是“lambert”、“phong”、“blinn”等光照模型,如果是“lambert”需要“u_ambint”,"u_light0Color"等信息。这些信息代表着模型本身的属性,如:环境光反射率、灯光的反射率、模型对灯光的反射强度等。

{"extensions": {"KHR_materials_common" : {"lights" : {"ambient_light_id": {"ambient": {"color": [1.0,1.0,1.0],"extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"name": "user-defined name of ambient light","type": "ambient","extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"directional_light_id": {"directional": {"color": [1.0,1.0,1.0],"extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"name": "user-defined name of directional light","type": "directional","extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"point_light_id": {"name": "user-defined name of point light","point": {"color": [1.0,1.0,1.0],"constantAttenuation": 1.0,"linearAttenuation": 0.5,"quadraticAttenuation": 0.25,"extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"type": "point","extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"spot_light_id": {"name": "user-defined name of spot light","spot": {"color": [1.0,1.0,1.0],"constantAttenuation": 1.0,"fallOffAngle": 40,"fallOffExponent": 0.0,"linearAttenuation": 0.5,"quadraticAttenuation": 0.25,"extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     },"type": "spot","extensions" : {"extension_name" : {"extension specific" : "value"}},"extras" : {"Application specific" : "The extra object can contain any properties."}     }}}},"nodes" : {"light_node_id": {"children": [],"matrix": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ],"name": "user-defined name of light node","extensions": {"KHR_materials_common" : {"light": "point_light_id"}}            }},"techniques" : {"technique_id" : {"name": "user-defined technique name","parameters": {"lightTransform": {"node": "directional_light_node_id","type": 35676},"modelViewMatrix": {"semantic": "MODELVIEW","type": 35676},"position": {"semantic": "POSITION","type": 35665},},"attributes": {"a_position": "position"},"program": "program_id","uniforms": {"u_lightTransformMatrix": "lightTransform"},}}
}

对于“KHR_materials_common”这个扩展,设置了灯光的颜色属性。

cesium gltf 1.0 2.0的一些扩展相关推荐

  1. libgstreamer-1.0.so.0: cannot open shared object file: No such file or directory

    1. 问题现象 error while loading shared libraries: libgstreamer-1.0.so.0: cannot open shared object file: ...

  2. c+语言+null,C/C++语言中NULL、'\0’和0的区别

    NULL.'\0'和0的值是一样的,都是0,不过它们的表现形式不一样: 1. NULL: 即空指针,不过在C和C++中并不一样.在VS 2013的库文件string.h中可以看到如果定义. 1 /* ...

  3. Ubuntu14.04 64位机上安装cuda8.0+cudnn5.0操作步骤

    查看Ubuntu14.04 64位上显卡信息,执行: lspci | grep -i vga lspci -v -s 01:00.0 nvidia-smi 第一条此命令可以显示一些显卡的相关信息:如果 ...

  4. Spring Cloud Alibaba 基础教程:Nacos 生产级版本 0.8.0

    Spring Cloud Alibaba 基础教程:Nacos 生产级版本 0.8.0 昨晚Nacos社区发布了第一个生产级版本:0.8.0.由于该版本除了Bug修复之外,还提供了几个生产管理非常重要 ...

  5. Silverlight 3发布新版3.0.50106.0

    微软1月19日发布Silverlight 3新版本3.0.50106.0. 该版本主要修复以下几个问题: 问题一: 当使用图形硬件加速功能(GPU)的时候,如果GPU驱动报错,Silverlight ...

  6. AS1.0(2.0)中的XML示例

    虽然Flash早就升级为AS3.0,但是FMS的服务端编程依然仅支持AS1.0(2.0),服务端与.net通讯的最简单方式莫过于请求一个RESTful的webService或wcf,通过它们返回的xm ...

  7. 多数编程语言里的0.1+0.2≠0.3?

    作者 | Parul Malhotra 译者 | Raku 出品 | AI科技大本营(ID:rgznai100) 我们从小就被教导说0.1+0.2=0.3,但是在奇妙的计算机编程世界里面,事情变得不一 ...

  8. flannel原理初探针对0.1.0版本

    flannel flannel是针对k8s设计的三层的网络解决方案.在k8s中为了使pod之间能够使用一种偏平的网络架构,从而完成跨Pod的网络通信. 官网给的原理图如下: flannel 使用TUN ...

  9. GTX 1080Ti + cuda8.0 + cuDNN6.0 安装及测试

    GPU 显卡厂商已经安装好了,直接安装 cuda8.0 + cuDNN6.0 我这里的显卡是 GTX 1080 Ti cuda安装 我下载的是cuda8.0的是deb格式的1.9个G地址:https: ...

最新文章

  1. 用什么软件测试mate9的闪存_超越苹果?余承东重拳出击,华为Mate40 Pro确认采用海思自研闪存!...
  2. 【采用】【评分卡开发】信用评分模型构建流程
  3. sonar规则之坏味道类型
  4. eclipse代码发布到服务器(Tomcat)出现乱码现象解决方法
  5. angularjs的表单验证
  6. laravel的重定向
  7. mysql hint use force ignore_MySQL实时在线备份恢复方案
  8. 【干货】写给初中级前端的高级进阶指南
  9. 支付宝有50万存款,但欠30万房贷。是还房贷好,还是买基金好?
  10. URL带中文参数的解决方法FR.cjkEncode()
  11. 阶段3 1.Mybatis_11.Mybatis的缓存_1 今日课程安排
  12. 物联网单片机毕业设计实现
  13. 安装制作 基础篇(一) 基本概念
  14. 手机wap浏览器的设计
  15. 基于android点餐系统需求分析,基于Android智能终端的点餐系统设计研究
  16. STM32基于 FatFs R0.14bSD Card 的MP3音乐播放器(也算是FatFs的简单应用了吧)
  17. Win11电脑怎么让两个屏幕任务栏都显示时间?
  18. Nubia Z18 联通VoLte修复,基带文件
  19. 如何让tensorflow_datasets加载本地下载的数据集
  20. C++ 指向数组的指针

热门文章

  1. 创新设计思维记录(part1)
  2. 在linux服务器上部署禅道环境
  3. 【java校招你不知道的那些事儿】java校招有没有考点大纲?不能拿面试补缺
  4. 【微信小程序】微信小程序项目开发哔哩哔哩小程序
  5. 计时器计算小时、分钟、秒数
  6. PyCharm 4.5 激活码
  7. 实战SOHO接单的全过程
  8. dell 2u服务器型号,DELL R730 2U机架式服务器
  9. 新员工如何快速融入新的工作环境
  10. 牛X,网易开源了这个项目后,结果被山寨出了无数个网易云音乐APP,网友炸锅了!...