-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add splitDirection property for PointPrimitive and Billboards #11982
Changes from 8 commits
947ba72
ddea3b7
2681891
d141e93
90fba65
2a6e949
65431b3
920cce1
16f21fa
e6d4085
293e3d3
5fa741d
fffcf2b
76151a7
abe2e58
c6e5ba3
11fc71c
8990124
834a79f
fe68fb3
505196a
aa7fe89
a12f124
f6dfd21
28e487d
07d5a92
7ec232a
ab23101
dceb99a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ const DISTANCE_DISPLAY_CONDITION_INDEX = | |
PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX; | ||
const DISABLE_DEPTH_DISTANCE_INDEX = | ||
PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX; | ||
const SPLIT_DIRECTION_INDEX = PointPrimitive.SPLIT_DIRECTION_INDEX; | ||
const NUMBER_OF_PROPERTIES = PointPrimitive.NUMBER_OF_PROPERTIES; | ||
|
||
const attributeLocations = { | ||
|
@@ -47,6 +48,7 @@ const attributeLocations = { | |
compressedAttribute1: 3, // show, translucency by distance, some free space | ||
scaleByDistance: 4, | ||
distanceDisplayConditionAndDisableDepth: 5, | ||
splitDirection: 6, | ||
}; | ||
|
||
/** | ||
|
@@ -216,6 +218,7 @@ function PointPrimitiveCollection(options) { | |
BufferUsage.STATIC_DRAW, // SCALE_BY_DISTANCE_INDEX | ||
BufferUsage.STATIC_DRAW, // TRANSLUCENCY_BY_DISTANCE_INDEX | ||
BufferUsage.STATIC_DRAW, // DISTANCE_DISPLAY_CONDITION_INDEX | ||
BufferUsage.STATIC_DRAW, // SPLIT_DIRECTION_INDEX | ||
]; | ||
|
||
const that = this; | ||
|
@@ -497,6 +500,12 @@ function createVAF(context, numberOfPointPrimitives, buffersUsage) { | |
componentDatatype: ComponentDatatype.FLOAT, | ||
usage: buffersUsage[DISTANCE_DISPLAY_CONDITION_INDEX], | ||
}, | ||
{ | ||
index: attributeLocations.splitDirection, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To save on the number of attributes, which is limited, let's pack this single float component along with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the comment. |
||
componentsPerAttribute: 1, | ||
componentDatatype: ComponentDatatype.FLOAT, | ||
usage: buffersUsage[SPLIT_DIRECTION_INDEX], | ||
}, | ||
], | ||
numberOfPointPrimitives | ||
); // 1 vertex per pointPrimitive | ||
|
@@ -700,6 +709,24 @@ function writeDistanceDisplayConditionAndDepthDisable( | |
writer(i, near, far, disableDepthTestDistance); | ||
} | ||
|
||
function writeSplitDirection( | ||
pointPrimitiveCollection, | ||
context, | ||
vafWriters, | ||
pointPrimitive | ||
) { | ||
const i = pointPrimitive._index; | ||
const writer = vafWriters[attributeLocations.splitDirection]; | ||
let direction = 0.0; | ||
|
||
const split = pointPrimitive.splitDirection; | ||
if (defined(split)) { | ||
direction = split; | ||
} | ||
|
||
writer(i, direction); | ||
} | ||
|
||
function writePointPrimitive( | ||
pointPrimitiveCollection, | ||
context, | ||
|
@@ -736,6 +763,12 @@ function writePointPrimitive( | |
vafWriters, | ||
pointPrimitive | ||
); | ||
writeSplitDirection( | ||
pointPrimitiveCollection, | ||
context, | ||
vafWriters, | ||
pointPrimitive | ||
); | ||
} | ||
|
||
function recomputeActualPositions( | ||
|
@@ -930,6 +963,10 @@ PointPrimitiveCollection.prototype.update = function (frameState) { | |
writers.push(writeDistanceDisplayConditionAndDepthDisable); | ||
} | ||
|
||
if (properties[SPLIT_DIRECTION_INDEX]) { | ||
writers.push(writeSplitDirection); | ||
} | ||
|
||
const numWriters = writers.length; | ||
|
||
vafWriters = this._vaf.writers; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please
main
branch and resolve any conflicts[11982](https://github.com/CesiumGS/cesium/pull/11982)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was done.
I also added an example in Sandcastle.