@@ -118,7 +118,7 @@ define([
118
118
this . _styleTranslucent = false ;
119
119
this . _constantColor = Color . clone ( Color . DARKGRAY ) ;
120
120
this . _highlightColor = Color . clone ( Color . WHITE ) ;
121
- this . _pointSize = 1 .0;
121
+ this . _pointSize = 10 .0;
122
122
123
123
this . _rtcCenter = undefined ;
124
124
this . _quantizedVolumeScale = undefined ;
@@ -540,71 +540,6 @@ define([
540
540
}
541
541
}
542
542
}
543
- var uniformMap = {
544
- u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier : function ( ) {
545
- var scratch = scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier ;
546
- scratch . x = pointCloud . _attenuation ? pointCloud . maximumAttenuation : pointCloud . _pointSize ;
547
- scratch . y = pointCloud . time ;
548
-
549
- if ( pointCloud . _attenuation ) {
550
- var frustum = frameState . camera . frustum ;
551
- var depthMultiplier ;
552
- // Attenuation is maximumAttenuation in 2D/ortho
553
- if ( frameState . mode === SceneMode . SCENE2D || frustum instanceof OrthographicFrustum ) {
554
- depthMultiplier = Number . POSITIVE_INFINITY ;
555
- } else {
556
- depthMultiplier = context . drawingBufferHeight / frameState . camera . frustum . sseDenominator ;
557
- }
558
-
559
- scratch . z = pointCloud . geometricError * pointCloud . geometricErrorScale ;
560
- scratch . w = depthMultiplier ;
561
- }
562
-
563
- return scratch ;
564
- } ,
565
- u_highlightColor : function ( ) {
566
- return pointCloud . _highlightColor ;
567
- } ,
568
- u_constantColor : function ( ) {
569
- return pointCloud . _constantColor ;
570
- } ,
571
- u_clippingPlanes : function ( ) {
572
- var clippingPlanes = pointCloud . clippingPlanes ;
573
- var isClipped = pointCloud . isClipped ;
574
- return isClipped ? clippingPlanes . texture : context . defaultTexture ;
575
- } ,
576
- u_clippingPlanesEdgeStyle : function ( ) {
577
- var clippingPlanes = pointCloud . clippingPlanes ;
578
- if ( ! defined ( clippingPlanes ) ) {
579
- return Color . TRANSPARENT ;
580
- }
581
-
582
- var style = Color . clone ( clippingPlanes . edgeColor , scratchColor ) ;
583
- style . alpha = clippingPlanes . edgeWidth ;
584
- return style ;
585
- } ,
586
- u_clippingPlanesMatrix : function ( ) {
587
- var clippingPlanes = pointCloud . clippingPlanes ;
588
- if ( ! defined ( clippingPlanes ) ) {
589
- return Matrix4 . IDENTITY ;
590
- }
591
- var modelViewMatrix = Matrix4 . multiply ( context . uniformState . view3D , pointCloud . _modelMatrix , scratchClippingPlaneMatrix ) ;
592
- return Matrix4 . multiply ( modelViewMatrix , clippingPlanes . modelMatrix , scratchClippingPlaneMatrix ) ;
593
- }
594
- } ;
595
-
596
- if ( isQuantized || isQuantizedDraco || isOctEncodedDraco ) {
597
- uniformMap = combine ( uniformMap , {
598
- u_quantizedVolumeScaleAndOctEncodedRange : function ( ) {
599
- var scratch = scratchQuantizedVolumeScaleAndOctEncodedRange ;
600
- if ( defined ( pointCloud . _quantizedVolumeScale ) ) {
601
- Cartesian3 . clone ( pointCloud . _quantizedVolumeScale , scratch ) ;
602
- }
603
- scratch . w = pointCloud . _octEncodedRange ;
604
- return scratch ;
605
- }
606
- } ) ;
607
- }
608
543
609
544
var positionsVertexBuffer = Buffer . createVertexBuffer ( {
610
545
context : context ,
@@ -735,10 +670,6 @@ define([
735
670
attributes : attributes
736
671
} ) ;
737
672
738
- if ( defined ( pointCloud . _uniformMapLoaded ) ) {
739
- uniformMap = pointCloud . _uniformMapLoaded ( uniformMap ) ;
740
- }
741
-
742
673
pointCloud . _opaqueRenderState = RenderState . fromCache ( {
743
674
depthTest : {
744
675
enabled : true
@@ -761,7 +692,7 @@ define([
761
692
vertexArray : vertexArray ,
762
693
count : pointsLength ,
763
694
shaderProgram : undefined , // Updated in createShaders
764
- uniformMap : uniformMap ,
695
+ uniformMap : undefined , // Updated in createShaders
765
696
renderState : isTranslucent ? pointCloud . _translucentRenderState : pointCloud . _opaqueRenderState ,
766
697
pass : isTranslucent ? Pass . TRANSLUCENT : pointCloud . _opaquePass ,
767
698
owner : pointCloud ,
@@ -771,6 +702,85 @@ define([
771
702
} ) ;
772
703
}
773
704
705
+ function createUniformMap ( pointCloud , frameState ) {
706
+ var context = frameState . context ;
707
+ var isQuantized = pointCloud . _isQuantized ;
708
+ var isQuantizedDraco = pointCloud . _isQuantizedDraco ;
709
+ var isOctEncodedDraco = pointCloud . _isOctEncodedDraco ;
710
+
711
+ var uniformMap = {
712
+ u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier : function ( ) {
713
+ var scratch = scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier ;
714
+ scratch . x = pointCloud . _attenuation ? pointCloud . maximumAttenuation : pointCloud . _pointSize ;
715
+ scratch . y = pointCloud . time ;
716
+
717
+ if ( pointCloud . _attenuation ) {
718
+ var frustum = frameState . camera . frustum ;
719
+ var depthMultiplier ;
720
+ // Attenuation is maximumAttenuation in 2D/ortho
721
+ if ( frameState . mode === SceneMode . SCENE2D || frustum instanceof OrthographicFrustum ) {
722
+ depthMultiplier = Number . POSITIVE_INFINITY ;
723
+ } else {
724
+ depthMultiplier = context . drawingBufferHeight / frameState . camera . frustum . sseDenominator ;
725
+ }
726
+
727
+ scratch . z = pointCloud . geometricError * pointCloud . geometricErrorScale ;
728
+ scratch . w = depthMultiplier ;
729
+ }
730
+
731
+ return scratch ;
732
+ } ,
733
+ u_highlightColor : function ( ) {
734
+ return pointCloud . _highlightColor ;
735
+ } ,
736
+ u_constantColor : function ( ) {
737
+ return pointCloud . _constantColor ;
738
+ } ,
739
+ u_clippingPlanes : function ( ) {
740
+ var clippingPlanes = pointCloud . clippingPlanes ;
741
+ var isClipped = pointCloud . isClipped ;
742
+ return isClipped ? clippingPlanes . texture : context . defaultTexture ;
743
+ } ,
744
+ u_clippingPlanesEdgeStyle : function ( ) {
745
+ var clippingPlanes = pointCloud . clippingPlanes ;
746
+ if ( ! defined ( clippingPlanes ) ) {
747
+ return Color . TRANSPARENT ;
748
+ }
749
+
750
+ var style = Color . clone ( clippingPlanes . edgeColor , scratchColor ) ;
751
+ style . alpha = clippingPlanes . edgeWidth ;
752
+ return style ;
753
+ } ,
754
+ u_clippingPlanesMatrix : function ( ) {
755
+ var clippingPlanes = pointCloud . clippingPlanes ;
756
+ if ( ! defined ( clippingPlanes ) ) {
757
+ return Matrix4 . IDENTITY ;
758
+ }
759
+ var modelViewMatrix = Matrix4 . multiply ( context . uniformState . view3D , pointCloud . _modelMatrix , scratchClippingPlaneMatrix ) ;
760
+ return Matrix4 . multiply ( modelViewMatrix , clippingPlanes . modelMatrix , scratchClippingPlaneMatrix ) ;
761
+ }
762
+ } ;
763
+
764
+ if ( isQuantized || isQuantizedDraco || isOctEncodedDraco ) {
765
+ uniformMap = combine ( uniformMap , {
766
+ u_quantizedVolumeScaleAndOctEncodedRange : function ( ) {
767
+ var scratch = scratchQuantizedVolumeScaleAndOctEncodedRange ;
768
+ if ( defined ( pointCloud . _quantizedVolumeScale ) ) {
769
+ Cartesian3 . clone ( pointCloud . _quantizedVolumeScale , scratch ) ;
770
+ }
771
+ scratch . w = pointCloud . _octEncodedRange ;
772
+ return scratch ;
773
+ }
774
+ } ) ;
775
+ }
776
+
777
+ if ( defined ( pointCloud . _uniformMapLoaded ) ) {
778
+ uniformMap = pointCloud . _uniformMapLoaded ( uniformMap ) ;
779
+ }
780
+
781
+ pointCloud . _drawCommand . uniformMap = uniformMap ;
782
+ }
783
+
774
784
var defaultProperties = [ 'POSITION' , 'COLOR' , 'NORMAL' , 'POSITION_ABSOLUTE' ] ;
775
785
776
786
function getStyleableProperties ( source , properties ) {
@@ -935,6 +945,8 @@ define([
935
945
attributeLocations [ attributeName ] = attribute . location ;
936
946
}
937
947
948
+ createUniformMap ( pointCloud , frameState ) ;
949
+
938
950
var vs = 'attribute vec3 a_position; \n' +
939
951
'varying vec4 v_color; \n' +
940
952
'uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \n' +
0 commit comments