blaxxun官方源码:
<applet code=com/blaxxun/bx3d/blaxxun3d.class height=330 name=browser width=280 archive="blaxxun3d.jar"> 
<param name="scene" value="example.wrl"> 
Sorry, your browser doesn't support Java.  
</applet> 
相关地址:http://developer.blaxxun.de/samples/index.html#blaxxun3d/examine/index.html
本人也想实现一个如上网址功能的网页,自己也编写了class文件,打包为.jar文件,路径设置也对,每次都是不出来正确结果,请高手给个指导,有简单的例子就最好啦~谢谢!!本人系java菜鸟,才学了一个礼拜java (不好意思~~)
部分参考代码:
本人编写的class文件:
import com.blaxxun.x3d.*;
import com.blaxxun.bx3d.blaxxun3d;abstract class test extends java.applet.Applet implements EventObserver {    private Browser       browser=null;
    
    private Node          clock1=null;
    private Field         enabled1=null;
    
    private int                         x=0;
public void start() {
// connect to blaxxun3d
while (browser==null) {
browser=blaxxun3d.getBrowser("browser");
hesitate();
}
        System.out.println("Got browser.");

// wait till everything is loaded
while (browser.getWorld()==null) {
hesitate();
}
        System.out.println("World loaded."); browser.addAWTObserver(this);
browser.addBrowserObserver(this); connectNodes();
}
public void stop() {
        browser.removeAWTObserver(this);
        browser.removeBrowserObserver(this);
    super.destroy();
} public boolean onEvent(int type, Object object, Object userData){             
    return false;
    }
    private void connectNodes() {
        try {
            clock1=browser.getNode("Timesensor");
            enabled1=clock1.getField("enabled");
        }
        catch (Exception e) {
            System.out.println(e+": Problems getting nodes!");
stop();
        }
        System.out.println("Got nodes.");
    }
     private void hesitate() {
try {
Thread.sleep(300);
}
catch(InterruptedException ignored) {}
}
}
编译后本人的jar文件包含了blaxxun官网下载的类包,本人自己编写的class为test.class,一并打包到test.jar中去,嵌入到html的代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>blaxxun interactive - MultiTexturing and Layer</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD><BODY onload=checktop()>
<APPLET 
       height=334 archive=test.jar  width=529 
      code=com\blaxxun\bx3d\blaxxun3d.class  name=browser MAYSCRIPT>
<PARAM NAME="scene" VALUE="box.wrl">
<PARAM NAME="statistics" VALUE="off">
<PARAM NAME="forcesw" VALUE="on">
<PARAM NAME="time" VALUE="timer">
<PARAM NAME="loading" VALUE="dynamic">
<PARAM NAME="lighting" VALUE="on">
<PARAM NAME="antialiasing" VALUE="off">
<PARAM NAME="textcolor" VALUE="ffffff">
<PARAM NAME="shadowcolor" VALUE="black">
<PARAM NAME="backcolor" VALUE="080808">
<PARAM NAME="backimage" VALUE="none">
<PARAM NAME="showanchor" VALUE="on">
<PARAM NAME="anchortextcolor" VALUE="black">
<PARAM NAME="anchorbackcolor" VALUE="black">
<PARAM NAME="regcode" VALUE="zYrFgmcMGck3b320XBMvxUFCe!nnSYPqqid">
       
<p align="center" class="link">&nbsp</p>    
</APPLET>
<APPLET height=0 archive=test.jar width=0 code=com\blaxxun\constants\Network.class name=browser MAYSCRIPT>
<PARAM NAME="collision" VALUE="on">
<PARAM NAME="mindistance" VALUE="0.5">
<PARAM NAME="extends" VALUE="browser">
</APPLET>
<SCRIPT language=JavaScript>
function M_o(){
        document.browser.setNodeField("clock","enabled","FALSE");
        
 }  </SCRIPT>
<a href="javascript:M_o()">1212</a>
</body>
</html>主要实现点击1212就让vrml虚拟场景停下来。
vrml的box.wrl文件代码如下:
#VRML V2.0 utf8
#written by blaxxunCC3D 5.104DEF ok Transform {
children DEF mm Shape {geometry Box {size 0.5 0.5 1}}
translation 0.151824 0 0
}
DEF clock TimeSensor {
cycleInterval 5
enabled TRUE 
loop TRUE 
}
DEF position PositionInterpolator {
key [0,0.5,1]
keyValue [-1 0 0,1 0 0,1.2 -0.5 -1]
}
ROUTE clock.fraction_changed TO position.set_fraction
ROUTE position.value_changed TO ok.set_translation
就做了一个box的移动,很简单。写了这么多,也不知有没有表达清楚,谢谢大虾啦~!