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

Added Shadows to ModelInstanceCollection #4341

Merged
merged 5 commits into from
Sep 20, 2016
Merged
Changes from 4 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
11 changes: 11 additions & 0 deletions Source/Scene/ModelInstanceCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ define([
* @param {Boolean} [options.show=true] Determines if the collection will be shown.
* @param {Boolean} [options.allowPicking=false] When <code>true</code>, each glTF mesh and primitive is pickable with {@link Scene#pick}.
* @param {Boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.
* @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the collection casts or receives shadows from each light source.
* @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for the collection.
* @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the instances in wireframe.
*
Expand Down Expand Up @@ -131,6 +132,7 @@ define([
this._gltf = options.gltf;
this._basePath = options.basePath;
this._asynchronous = options.asynchronous;
this._shadows = options.shadows;

this.debugShowBoundingVolume = defaultValue(options.debugShowBoundingVolume, false);
this._debugShowBoundingVolume = false;
Expand Down Expand Up @@ -164,6 +166,14 @@ define([
get : function() {
return this._readyPromise.promise;
}
},
shadows : {
get : function () {
return this._model.shadows;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add a set function that sets this._model.shadows.

set : function () {
this._model.shadows = shadows;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After closer review I noticed that setting the shadows dynamically is actually more involved that setting the model's shadow property. Would you mind removing this getter/setter for now? I'll be happy to merge the rest of the changes and should have a different PR open soon.

}
}
});

Expand Down Expand Up @@ -491,6 +501,7 @@ define([
requestType : collection._requestType,
gltf : collection._gltf,
basePath : collection._basePath,
shadows : collection._shadows,
cacheKey : undefined,
asynchronous : collection._asynchronous,
allowPicking : collection._allowPicking,
Expand Down