Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

S3MCreateIndexJob.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const { Cesium } = DC.Namespace
  2. function S3MCreateIndexBufferJob(){
  3. this.model = undefined;
  4. this.context = undefined;
  5. this.index = 0;
  6. }
  7. S3MCreateIndexBufferJob.prototype.set = function(context, model, index) {
  8. this.model = model;
  9. this.context = context;
  10. this.index = index;
  11. };
  12. S3MCreateIndexBufferJob.prototype.execute = function(){
  13. let context = this.context;
  14. let indexPackage = this.model.arrIndexPackage[this.index];
  15. let verticesCount = this.model.vertexPackage.verticesCount;
  16. if(!Cesium.defined(indexPackage)){
  17. throw new Cesium.DeveloperError('index package is null');
  18. }
  19. if(Cesium.defined(indexPackage.indexBuffer)){
  20. return ;
  21. }
  22. if(!Cesium.defined(indexPackage.indicesTypedArray)){
  23. throw new Cesium.DeveloperError('index buffer is null');
  24. }
  25. let indexDataType = Cesium.IndexDatatype.UNSIGNED_SHORT;
  26. if((indexPackage.indexType === 1 || verticesCount >= Cesium.Math.SIXTY_FOUR_KILOBYTES) && context.elementIndexUint) {
  27. indexDataType = Cesium.IndexDatatype.UNSIGNED_INT;
  28. }
  29. if(!Cesium.defined(indexPackage.indexBuffer)){
  30. indexPackage.indexBuffer = Cesium.Buffer.createIndexBuffer({
  31. context : context,
  32. typedArray : indexPackage.indicesTypedArray,
  33. usage : Cesium.BufferUsage.STATIC_DRAW,
  34. indexDatatype : indexDataType
  35. });
  36. }
  37. indexPackage.indicesTypedArray = null;
  38. delete indexPackage.indicesTypedArray;
  39. };
  40. export default S3MCreateIndexBufferJob;