2007年05月22日
Simple3D
SIMPLE3D
ファイルをダウンロード
例
なるべくシンプルに作ろうということで考えてみた。
なるべくクラスは少なく、中で何が行われてるのかが分かりやすくというコンセプトで。
import net.hiphi.*;
var cam:Camera3D = new Camera3D();
cam.angle = 300;
var p01:Simple3D = new Simple3D(cam);
p01.px = -100;
p01.py = -100;
p01.pz = -100;
var p02:Simple3D = new Simple3D(cam);
p02.px = -100;
p02.py = 100;
p02.pz = -100;
var p03:Simple3D = new Simple3D(cam);
p03.px = 100;
p03.py = 100;
p03.pz = -100;
var p04:Simple3D = new Simple3D(cam);
p04.px = 100;
p04.py = -100;
p04.pz = -100;
_root.createEmptyMovieClip("canvas",_root.getNextHighestDepth());
_root.onEnterFrame = function(){
var aY = (_root._xmouse - Stage.width/2)/3000;
var aX = (_root._ymouse - Stage.height/2)/3000;
//回転
p01.rotate(aX,aY);
p02.rotate(aX,aY);
p03.rotate(aX,aY);
p04.rotate(aX,aY);
//透視変換
p01.perspective();
p02.perspective();
p03.perspective();
p04.perspective();
//画面をクリア
canvas.clear();
//描画(こちらを向いているときだけ)
//if(net.hiphi.toolkit3D.isHiddenSurface(p03,p02,p01)){
var rectScale = 10;
canvas.lineStyle(1,0x000000,50);
canvas.moveTo(p01.dx,p01.dy);
canvas.beginFill(0x000000,50);
canvas.lineTo(p02.dx,p02.dy);
canvas.lineTo(p03.dx,p03.dy);
canvas.lineTo(p04.dx,p04.dy);
canvas.endFill();
//}
}
投稿者 hiphi : 2007年05月22日 13:09
トラックバック
このエントリーのトラックバックURL:
http://hiphi.net/cgi/mt/mt-tb.cgi/95
コメント
Hell yeah! This post sounds really good. Reading your blog is useful and interesting. Keep it that way.
投稿者 DarkChild : 2008年04月07日 03:05
I’m in a difficult situation. Confused. Why would anyone write this kind of material? What’s the point?
投稿者 fpsgib : 2008年04月09日 19:02