BruceSherwood / glowscript

This repository has been moved to https://github.com/vpython/glowscript
50 stars 17 forks source link

Interaction of compound and transparency #12

Closed BruceSherwood closed 9 years ago

BruceSherwood commented 9 years ago

From Marshall Styczinski:

I've narrowed down the issue further. The problems with transparency arise when a new compound object is created.

If the new compound has fewer of any type of object than older compounds, the older compounds have transparency issues.

Creating a new compound only messes with those older compounds which fit this description, not all of the older compounds.

scene.width = 1000 scene.height = 1000 scene.background = color.white

page = box( pos=vec(0,0,-5), axis=vec(1,0,0), size=vec(30,20,0.05), opacity=0.4 )

or1 = cylinder( pos=vec(6,0,0), axis=vec(0,1,0), size=vec(8,5,5), color=color.red, opacity=0.3 ) scene.waitfor('click') or2 = cone( pos=vec(-4,0,0), axis=vec(0,1,0), size=vec(8,5,5), color=color.red ) scene.waitfor('click') or3 = box( pos=vec(0,0,0), axis=vec(0,1,0), size=vec(6,4,4), color=color.red ) scene.waitfor('click')

bl1 = cylinder( pos=vec(6,-3,0), axis=vec(0,1,0), size=vec(6,4,4), color=color.blue ) scene.waitfor('click') bl2 = cone( pos=vec(-3,-3,1), axis=vec(0,1,0), size=vec(6,4,4), color=color.blue ) scene.waitfor('click')

gr1 = cone( pos=vec(6,-4,0), axis=vec(0,1,0), size=vec(4,3,3), color=color.green )

gr2 = box( pos=vec(-5,-4,1), axis=vec(0,1,0), size=vec(4,3,3), color=color.green )

scene.waitfor('click',wait)

comp1 = compound( [or1,or2,or3] ) # making this compound object is fine, before or after creating the simple objects; but objects are shinier scene.waitfor('click') comp2 = compound( [bl1,bl2] ) # making the second compound object causes a problem with the first, when the first contains objects not in the second

scene.waitfor('click',wait)

comp3 = compound( [gr1,gr2] ) # Causes issues with earlier compound objects if comp3 has fewer of any type

1) Creating a compound => the objects get shinier

2) Creating a second compound that doesn't include objects in the first compound causes trouble=

The back screen shows in front of compound 1 and you can see blue objects inside the orange ones, colored orange

BruceSherwood commented 9 years ago

Fixed.