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

LightProbe: Add support for serialization/deserialization. #18966

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 24, 2020

After 21e3eab, serialization/deserialization is now easy to add.

@@ -26,7 +28,6 @@ LightProbe.prototype = Object.assign( Object.create( Light.prototype ), {
Light.prototype.copy.call( this, source );

this.sh.copy( source.sh );
this.intensity = source.intensity;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

intensity is already copied in Light.copy().

Copy link
Owner

Choose a reason for hiding this comment

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

As a FYI, seems like @WestLangley is thinking of removing that inheritance. #18371 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for sharing, good to know! Should I keep the code as it is now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think so -- for now.

@mrdoob
Copy link
Owner

mrdoob commented Mar 25, 2020

After 21e3eab, serialization/deserialization is now easy to add.

I forgot I did that. 👴

@@ -36,7 +46,7 @@ LightProbe.prototype = Object.assign( Object.create( Light.prototype ), {

var data = Light.prototype.toJSON.call( this, meta );

// data.sh = this.sh.toArray(); // todo
data.object.sh = this.sh.toArray();
Copy link
Owner

Choose a reason for hiding this comment

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

data.object.sh?

Copy link
Collaborator Author

@Mugen87 Mugen87 Mar 25, 2020

Choose a reason for hiding this comment

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

Yes, check out Light.toJSON():

data.object.intensity = this.intensity;

@mrdoob mrdoob added this to the r116 milestone Apr 3, 2020
@mrdoob mrdoob merged commit d26c835 into mrdoob:dev Apr 3, 2020
@mrdoob
Copy link
Owner

mrdoob commented Apr 3, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants