Skip to content

Conversation

@wemamawe
Copy link
Contributor

some model is transparent, so it should parse MAT_TRANSPARENCY, and convert MAT_TRANSPARENCY to material.oapcity

some model is transparent, so it should parse MAT_TRANSPARENCY, and convert MAT_TRANSPARENCY to material.oapcity
material.shininess = shininess;
this.debugMessage( ' Shininess : ' + shininess );

} else if ( next === MAT_TRANSPARENCY ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you test this PR?

Where is MAT_TRANSPARENCY defined?

Copy link
Contributor Author

@wemamawe wemamawe Sep 10, 2019

Choose a reason for hiding this comment

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

yes, i had tested, first i read code of lib3ds

            case CHK_MAT_SHININESS: {
                lib3ds_chunk_read_reset(&c, io);
                int_percentage_read(&material->shininess, io);
                break;
            }

            case CHK_MAT_SHIN2PCT: {
                lib3ds_chunk_read_reset(&c, io);
                int_percentage_read(&material->shin_strength, io);
                break;
            }

            case CHK_MAT_TRANSPARENCY: {
                lib3ds_chunk_read_reset(&c, io);
                int_percentage_read(&material->transparency, io);
                break;
            }

then, There also has MAT_TRANSPARENCY parameter in TDSLoader

Copy link
Collaborator

Choose a reason for hiding this comment

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

MAT_TRANSPARENCY is undefined, so your code will throw an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

var MAT_TRANSPARENCY = 0xA050;
it is defined in TDSLoader.js at line 965

Copy link
Owner

Choose a reason for hiding this comment

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

The line is commented out:

// var MAT_TRANSPARENCY = 0xA050;

Copy link
Contributor Author

@wemamawe wemamawe Sep 10, 2019

Choose a reason for hiding this comment

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

oh, the version of my local computer THREE.js is v101, that line didn't commented

Copy link
Owner

Choose a reason for hiding this comment

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

Better use the dev branch as base for your changes when submitting PRs.

Copy link
Contributor Author

@wemamawe wemamawe Sep 10, 2019

Choose a reason for hiding this comment

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

yes, it is

dev

branch in my github account

Copy link
Owner

Choose a reason for hiding this comment

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

You just said that you used r101 as base for your PR. dev is on r109dev...

Copy link
Contributor Author

@wemamawe wemamawe Sep 10, 2019

Choose a reason for hiding this comment

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

sorry, maybe i didn't say very clearly, In my github account, i fork your dev version, and at my local computer, i used 101 version.

var opacity = this.readWord( data );
material.opacity = opacity*0.01;
this.debugMessage( ' Opacity : ' + opacity );
material.transparent = opacity<100 ? true : false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Formatting

var opacity = this.readWord( data );
material.opacity = opacity * 0.01;
this.debugMessage( '  Opacity : ' + opacity );
material.transparent = opacity < 100 ? true : false;

Please remember to use tabs, not spaces.

Copy link
Collaborator

@Mugen87 Mugen87 Sep 17, 2019

Choose a reason for hiding this comment

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

@wemamawe Still interested in fixing these formatting issues? Besides, the loader is still missing the declaration of MAT_TRANSPARENCY and thus produces a runtime error.

Live demo: https://jsfiddle.net/7ju6Lw28/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Mugen87 I delete that coment befor var MAT_TRANSPARENCY = 0xA050;

Copy link
Collaborator

@Mugen87 Mugen87 Sep 17, 2019

Choose a reason for hiding this comment

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

I delete that coment befor var MAT_TRANSPARENCY = 0xA050;

Have you forgotten to commit this change? I can't see the respective line in the diff (besides, the live demo is still broken).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
now it works

@mrdoob mrdoob changed the title parse opacity of material TDSLoader: parse opacity of material Sep 10, 2019
@mrdoob mrdoob added this to the r109 milestone Sep 10, 2019
@mrdoob
Copy link
Owner

mrdoob commented Sep 18, 2019

@wemamawe here you can see the changes in this PR:

https://github.com/mrdoob/three.js/pull/17456/files

As you can see, it's still missing the MAT_TRANSPARENCY declaration.

@Mugen87 Mugen87 merged commit 2e337a8 into mrdoob:dev Sep 19, 2019
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 19, 2019

Resolved style issues and updated module here: #17534

@mrdoob
Copy link
Owner

mrdoob commented Sep 19, 2019

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.

4 participants