アットウィキロゴ

じゃヴぁ0917

import java.awt.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.applet.MainFrame;
import java.awt.event.*;

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・アプレットの作成・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
public class game0917 extends Frame{
public game0917( ){

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・シーングラフの構築・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
       Canvas3D canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
           // Canvas3Dクラスのインスタンスを生成
       BorderLayout borderLayout = [[new]] BorderLayout( );
           // BorderLayoutクラスのインスタンスを生成
       this.setLayout( borderLayout );
           // レイアウトの設定
       this.add( [[canvas]]3D, BorderLayout.CENTER );
           // キャンバスの位置の設定
       SimpleUniverse simpleUniverse= new SimpleUniverse( canvas3D );
           // SimpleUniverseクラスのインスタンスを生成
       simpleUniverse.getViewingPlatform( ).setNominalViewingTransform( );
           // 視点の移動
       BranchGroup objRoot = new BranchGroup( );
           // BranchGroupクラスのインスタンスを生成

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・光源の設定・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
       BoundingSphere boundingSphere = new BoundingSphere( );
           // BoundingSphereクラスのインスタンスを生成
       DirectionalLight directionalLight = new DirectionalLight( );
           // DirectionalLightクラスのインスタンスを生成
       directionalLight.setInfluencingBounds( boundingSphere );
           // 「directionalLight」の描画範囲として「boundingSphere」を設定

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・キャラクターの生成・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
       model0917 chicken = new model0917( );
           // Chickenクラスのインスタンスを生成

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・物体等をシーングラフに追加・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
       objRoot.addChild( chicken );
           // 「chicken」を「objRoot」に追加
       objRoot.addChild( directionalLight );
           // 「direcrtionalLight」を「objRoot」に追加

/*・・・・・・・・・・・・・・・・・・・・・・・・・物体側のツリーをシーングラフに追加・・・・・・・・・・・・・・・・・・・・・・・*/
       simpleUniverse.addBranchGraph( objRoot );
           // 「objRoot」を「simpleUniverse」に追加

addWindowListener(new stopwin());

}


class stopwin extends WindowAdapter{
   public void windowClosing(WindowEvent we){System.exit(0);} 
}
/*・・・・・・・・・・・・・・・・・・・・・・・・・作成したクラスファイルの呼び出し・・・・・・・・・・・・・・・・・・・・・・・・・*/
public static void main( String[ ] argv ){
       game0917 f = new game0917( );
       
f.setSize(400,400);
       f.setVisible(true); 

}
}
最終更新:2011年03月03日 23:55