Re: controlling shading




Well, following your example, and putting my version of makeAppearance into
ShadowUnshadedFunctionTypeJ3D worked just as it should, thanks. My problem
mainly was figuring out where to put it; The bom barbrenderer example put
it into the ShadowBarbRealTupleType class (if I recall), while the bom
ImageRenderer puts it into ShadowFunctionType.  How does one know the
*right* place to put it?

Donna

Donna L. Gresh, Ph.D.
IBM T.J. Watson Research Center
(914) 945-2472
http://www.research.ibm.com/people/g/donnagresh
gresh@xxxxxxxxxx




                                                                                
                                                       
                      Bill Hibbard                                              
                                                       
                      <hibbard@xxxxxxxxxx        To:       Donna L 
Gresh/Watson/IBM@IBMUS                                              
                      isc.edu>                   cc:       
visad-list@xxxxxxxxxxxxx                                                    
                      Sent by:                   Subject:  Re: controlling 
shading                                                     
                      owner-visad-list@ss                                       
                                                       
                      ec.wisc.edu                                               
                                                       
                                                                                
                                                       
                                                                                
                                                       
                      01/27/2003 11:39 AM                                       
                                                       
                                                                                
                                                       




Hi Donna,

> Hmmm, I'm still missing something. What I've got now is a class
> UnshadedRenderJ3D, which has a bunch of things along the lines of
>
> public class UnshadedRendererJ3D extends DefaultRendererJ3D {
>
>   public UnshadedRendererJ3D () {
>     super();
>   }
>   public ShadowType makeShadowType(
>          FunctionType type, DataDisplayLink link, ShadowType parent)
>          throws VisADException, RemoteException {
>     return new ShadowUnshadedTypeJ3D(type, link, parent);
>   }
>   public ShadowType makeShadowFunctionType(
>          FunctionType type, DataDisplayLink link, ShadowType parent)
>          throws VisADException, RemoteException {
>     return new ShadowUnshadedFunctionTypeJ3D(type, link, parent);
>   }
> .......
>
> Then I have a new version of (non-static) makeAppearance, which I have
> placed in ShadowUnshadedTypeJ3D. This version of makeAppearance does
> something different with the lighting. But I'm never entering that
method.
> What else do I need to do? I previously had a bunch of makeAppearances
also
> in the other ShadowUnshaded.... guys, just referring back to the one in
> ShadowUnshadedTypeJ3D, but the compiler complains about referencing a
> non-static method from a static context... I'm not enough of a java
expert
> to sort this all out...

Just to test this, I tried it myself, adding the method:

  public Appearance makeAppearance(GraphicsModeControl mode,
                      TransparencyAttributes constant_alpha,
                      ColoringAttributes constant_color,
                      GeometryArray geometry, boolean no_material) {
    System.out.println("ShadowImageFunctionTypeJ3D.makeAppearance");
    return super.makeAppearance(mode, constant_alpha,
                           constant_color, geometry, no_material);
  }

to visad/bom/ShadowImageFunctionTypeJ3D.java. Then I ran:

  doll% java visad.bom.ShadowImageFunctionTypeJ3D test.gif
  ShadowImageFunctionTypeJ3D.makeAppearance

and as you see it did print the message that it was invoked.

I suggest you compare your DataRenderer and ShadowTypes to:

  visad/bom/ImageRendererJ3D.java

and:

  visad/bom/ShadowImageFunctionTypeJ3D.java

and compare your code to these, with respect to what
class extends what, etc.

Good luck,
Bill