P. Flavin wrote:

>http://archives.java.sun.com/cgi-bin/wa?A2=ind0203&L=java3d-interest&P=3085
>
>  It was done by Sun back in 1998,
>  I've been using the Sun VRML Loaders since 1999,
>  and use them for Animating Web3d's H-Anim Avatars on the Web:
>
>The Sun VRML Loaders have worked very well
>for me, but I don't recall any VRML files actually
>using the Visibility Sensor, do you have a VRML file
>with using the VisibilitySensor ?
>
Thank you Paul.  You've shown my point exactly.  If you'd bother to
actually read the code you would see that this class does nothing.  It
adds it to a list called VisibilitySensor and then forgets about it.
 The old loaders need serious work to be a full VRML97 implementation,
and we are doing that work.  Why not do some work yourself Paul?

>
package com.sun.j3d.loaders.vrml97.impl;

public class VisibilitySensor extends Node {

    // exposedField
    SFVec3f center;
    SFBool enabled;
    SFVec3f size;

    // Event outs
    SFBool    isActive;
    SFTime    enterTime;
    SFTime    exitTime;

    public VisibilitySensor(Loader loader ) {
    super(loader);
    enabled = new SFBool(true);
    isActive = new SFBool(true);
    enterTime = new SFTime(0.0);
    exitTime = new SFTime(0.0);
    loader.addVisibilitySensor(this);
    initFields();
    }

    VisibilitySensor(Loader loader, SFBool enabled, SFVec3f center,
SFVec3f size,
        SFTime enterTime, SFTime exitTime, SFBool isActive) {
    super(loader);
    this.enabled = enabled;
    this.enterTime = enterTime;
    this.exitTime = exitTime;
    this.isActive = isActive;
    loader.addVisibilitySensor(this);
    initFields();
    }

    //public void initImpl() { ; } // tbd

    public void notifyMethod(String eventInName, double time) {
        if (eventInName.equals("enabled")) {
        } else {
            System.err.println("VisibilitySensor: unknown eventInName " +
        eventInName);
        }
    }

    public Object clone() {
    VisibilitySensor v = new VisibilitySensor(loader,
(SFBool)enabled.clone(),
        (SFVec3f)center.clone(), (SFVec3f)size.clone(),
(SFTime)enterTime.clone(),
        (SFTime)exitTime.clone(), (SFBool)isActive.clone());
    return v;
    }

    public String getType() { return "VisibilitySensor"; }

    void initFields() {
    enabled.init(    this, FieldSpec, Field.EXPOSED_FIELD, "enabled");
    center.init(  this, FieldSpec, Field.EXPOSED_FIELD,    "center");
    size.init(   this, FieldSpec, Field.EXPOSED_FIELD,     "size");
    isActive.init(   this, FieldSpec, Field.EVENT_OUT,     "isActive");
    enterTime.init(  this, FieldSpec, Field.EVENT_OUT,     "enterTime");
    exitTime.init(  this, FieldSpec, Field.EVENT_OUT,      "exitTime");
    }


}

--
Alan Hudson
President: Yumetech, Inc.                      http://www.yumetech.com/
Web3D Open Source Chair        http://www.web3d.org/TaskGroups/source/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to