アットウィキロゴ

0916

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

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

/*・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・シーングラフの構築・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・*/
        Canvas3D canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
            // Canvas3Dクラスのインスタンスを生成
        BorderLayout borderLayout = new BorderLayout( );
            // BorderLayoutクラスのインスタンスを生成
        this.setLayout( borderLayout );
            // レイアウトの設定
        this.add( canvas3D, 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」を設定

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

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

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

/*・・・・・・・・・・・・・・・・・・・・・・・・・作成したクラスファイルの呼び出し・・・・・・・・・・・・・・・・・・・・・・・・・*/
public static void main( String[ ] argv ){
        game0916 f = new game0916( );
        
f.setSize(400,400);
        f.setVisible(true);

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