primitive

A primitive represents geometry in the Scene. The geometry can be from a single GeometryInstance as shown in example 1 below, or from an array of instances, even if the geometry is from different geometry types, e.g., an RectangleGeometry and an EllipsoidGeometry as shown in Code Example 2.

A primitive combines geometry instances with an Appearance that describes the full shading, including Material and RenderState. Roughly, the geometry instance defines the structure and placement, and the appearance defines the visual characteristics. Decoupling geometry and appearance allows us to mix and match most of them and add a new geometry or appearance independently of each other.

Combining multiple instances into one primitive is called batching, and significantly improves performance for static data. Instances can be individually picked; Scene#pick returns their GeometryInstance#id. Using per-instance appearances like PerInstanceColorAppearance, each instance can also have a unique color.

Geometry can either be created and batched on a web worker or the main thread. The first two examples show geometry that will be created on a web worker by using the descriptions of the geometry. The third example shows how to create the geometry on the main thread by explicitly calling the createGeometry method.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • 可能是年纪越来越大了,没事总想家,总想爸妈。时间太晚了,明天再给老妈打电话。 以前总觉得老妈爱唠叨,没等她说上两句...
    暖男邱阅读 218评论 0 2
  • 21天的写作生涯终于结束了! 马上到了跟轻坚持写作帮的小伙伴们道别啦! 虽然有些不舍得离开! 但是该道别的时候就该...
    李_昀倩阅读 181评论 0 1
  • 《齐物论》 南郭子綦隐机而坐,仰天而嘘,荅焉似丧其耦。 颜成子游立侍乎前,曰:“何居乎...
    li33阅读 388评论 0 1