Skip to content
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 the option vertexShaderCommon to prepend the custom vertexshader … #12327

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Kirn Kim](https://github.com/squrki)
- [Emanuele Mastaglia](https://github.com/Masty88)
- [Connor Manning](https://github.com/connormanning)
- [Michael Musset](https://github.com/mickae1)
5 changes: 5 additions & 0 deletions packages/engine/Source/Scene/PolylineMaterialAppearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (!FeatureDetection.isInternetExplorer()) {
* @param {object} [options] Object with the following properties:
* @param {boolean} [options.translucent=true] When <code>true</code>, the geometry is expected to appear translucent so {@link PolylineMaterialAppearance#renderState} has alpha blending enabled.
* @param {Material} [options.material=Material.ColorType] The material used to determine the fragment color.
* @param {boolean} [options.vertexShaderCommon] prepend PolylineCommon.glsl to vertexShaderSource
* @param {string} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader.
* @param {string} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader.
* @param {object} [options.renderState] Optional render state to override the default render state.
Expand All @@ -50,6 +51,7 @@ if (!FeatureDetection.isInternetExplorer()) {
function PolylineMaterialAppearance(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

const vertexShaderCommon = defaultValue(options.vertexShaderCommon, false);
const translucent = defaultValue(options.translucent, true);
const closed = false;
const vertexFormat = PolylineMaterialAppearance.VERTEX_FORMAT;
Expand Down Expand Up @@ -78,6 +80,9 @@ function PolylineMaterialAppearance(options) {
*/
this.translucent = translucent;

if(vertexShaderCommon && options.vertexShaderSource) {
options.vertexShaderSource = `${PolylineCommon}\n${options.vertexShaderSource}`
}
this._vertexShaderSource = defaultValue(
options.vertexShaderSource,
defaultVertexShaderSource,
Expand Down