![]() |
|
||||||||||
|
|||||
|
ты молоток!
я не наезжаю на тебя... наоборот - хвалю!!!
__________________
Max. |
|
|||||
|
Регистрация: Jan 2002
Адрес: germany nurnberg
Сообщений: 8
|
tak eto i ne byli pretenzii,prosta skazal...
danke
__________________
ars |
|
|||||
|
в поддержание темы:
//---------- Define all my needed functions -----------
function Point2D(x, y) {
this.x = x;
this.y = y;
}
function Point3D(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
function Object3D(screenX, screenY) {
this.screenX = screenX;
this.screenY = screenY;
this.D = 500;
this.PointList = new Array();
this.FaceList = new Array();
this.NumPoints = 0;
this.NumFaces = 0;
}
Object3D.prototype.AddPoint = function(x, y, z) {
this.PointList[this.NumPoints++] = new Point3D(x, y, z);
};
Object3D.prototype.AddFace = function(FaceName, Face, Colour, Outline) {
this.FaceList[this.NumFaces] = Face;
this.FaceList[this.NumFaces].FaceName = FaceName;
this.FaceList[this.NumFaces].Colour = Colour;
this.FaceList[this.NumFaces++].Outline = Outline;
};
Object3D.prototype.DrawFace = function(Face, depth) {
var Pt2D = new Array();
for (var i = 0; i<Face.length; i++) {
Pt2D[i] = new Point2D((this.D*(this.PointList[Face[i]].x/(this.PointList[Face[i]].z+this.D)))+this.screenX, (this.D*(this.PointList[Face[i]].y/(this.PointList[Face[i]].z+this.D)))+this.screenY);
}
if (this.getVisible(Pt2D[0], Pt2D[1], Pt2D[2])) {
_root.createEmptyMovieClip(Face.FaceName, depth);
tellTarget (_root[Face.FaceName]) {
beginFill(Face.Colour, 100);
if (Face.Outline) {
lineStyle(0, 0x000000, 100);
}
moveTo(Pt2D[0].x, Pt2D[0].y);
for (var i = 1; i<Face.length; i++) {
lineTo(Pt2D[i].x, Pt2D[i].y);
}
lineTo(Pt2D[0].x, Pt2D[0].y);
endFill();
}
} else {
_root[Face.FaceName].removeMovieClip();
}
};
Object3D.prototype.getVisible = function(p1, p2, p3) {
return ((p2.x-p1.x)*(p3.y-p1.y)<(p3.x-p1.x)*(p2.y-p1.y));
};
Object3D.prototype.DrawObject3D = function() {
for (var i = 0; i<this.FaceList.length; i++) {
this.DrawFace(this.FaceList[i], i);
}
};
Object3D.prototype.RotateObject3D = function(x, y) {
for (var i = 0; i<this.PointList.length; i++) {
var px = this.PointList[i].x;
var py = this.PointList[i].y;
var pz = this.PointList[i].z;
var temp_y = py*Math.cos(x)+pz*Math.sin(x);
var temp_z1 = pz*Math.cos(x)-py*Math.sin(x);
var temp_x = px*Math.cos(y)-temp_z1*Math.sin(y);
var temp_z = px*Math.sin(y)+temp_z1*Math.cos(y);
this.PointList[i] = new Point3D(temp_x, temp_y, temp_z);
}
};
//---------- Create the object -----------
PYRAMID = new Object3D(275, 200);
PYRAMID.AddPoint(30, -30, 30);
PYRAMID.AddPoint(30, -30, -30);
PYRAMID.AddPoint(-30, -30, -30);
PYRAMID.AddPoint(-30, -30, 30);
PYRAMID.AddPoint(0, 40, 0);
PYRAMID.AddFace("Face0", [4, 0, 1], 0x00ff00,true);
PYRAMID.AddFace("Face1", [4, 1, 2], 0x0000ff, true);
PYRAMID.AddFace("Face2", [4, 2, 3], 0xffff00, true);
PYRAMID.AddFace("Face3", [4, 3, 0], 0xff0000, true);
PYRAMID.AddFace("Face4", [3, 2, 1, 0], 0x00ffff, true);
this.onEnterFrame = function() {
var xa = (200-_root._ymouse)/1000;
var ya = (_root._xmouse-275)/1000;
PYRAMID.RotateObject3D(xa, ya);
PYRAMID.DrawObject3D();
};
по повуду движка, кто нибудь нормальную инву нашёл ???
__________________
file-> new-> F9 -> Ctrl+v/*code*/ ->ctrl+enter |
|
|||||
|
типа этого..
только не хватает визуального редакора-конструктора объектов. ![]()
__________________
Max. |
|
|||||
|
Регистрация: Jan 2002
Адрес: germany nurnberg
Сообщений: 8
|
khm khm... da uj popisat was i medom ne kormi- krasawchiki
jalko toka chto smotrish na eto kak baran na no... nu wy znaete. surowo surowo a glawnoe kruto(daje krutee chem kruto) tak derjat(aj za rodinu ne obidno-hotja w prinzipe nikogda i ne bylo) p.s. toka jalko chto ne blikow ne teney i nichego iz detaley tuda ne dobawit ili po krayney mere ne tak uj legko sdelat. a tak.... uhhh....
__________________
ars |
|
|||||
|
и не столько непонятно, где это делается,
как непонятно, КАК это экспортируется во FLASH |
|
|||||
|
да ладно... просто в акшен вставить и всё...
__________________
file-> new-> F9 -> Ctrl+v/*code*/ ->ctrl+enter |
|
|||||
|
а действительно, какой 3D движок (типа этой пирамиды) минимально загружает процессор,- так сказать вылизанный код?
![]()
__________________
http://xitri.com |
![]() |
Часовой пояс GMT +4, время: 18:17. |
|
|
« Предыдущая тема | Следующая тема » |
|
|