- var file:String = "pyramide.fobj";
- var origine:Object;
- var cam:Object;
- var viewport:Number;
- var meshObject:Array;
- var xmlObject:XML = new XML();
- var cam_:Object = {x:0, y:0, z:98, step:0.2};
-
- var meshBuilder = new mesh();
- var drawMethod = new draw(_root);
-
- origine = {x:300, y:200};
- viewport = 52;
- xmlObject.ignoreWhite = true;
- xmlObject.load(file);
- xmlObject.onLoad = function(flag) {
- if (flag) {
- // si vous chargez au format xml:
- //_root.meshObject = meshBuilder.loadMeshFromXML(this);
- _root.meshObject = _root.meshBuilder.loadMeshFromDataFile(this);
- _root.drawMethod.setFill(40, 0x336699);
- _root.drawMethod.setLine(100, 0x000000, -1);
- setInterval(function () {
- if (Key.isDown(Key.LEFT)) {
- _root.cam_.x -= _root.cam_.step;
- }
- if (Key.isDown(Key.RIGHT)) {
- _root.cam_.x += _root.cam_.step;
- }
- if (Key.isDown(Key.UP)) {
- _root.cam_.y -= _root.cam_.step;
- }
- if (Key.isDown(Key.DOWN)) {
- _root.cam_.y += _root.cam_.step;
- }
- if (Key.isDown(Key.PGUP)) {
- _root.cam_.z -= _root.cam_.step;
- }
- if (Key.isDown(Key.PGDN)) {
- _root.cam_.z += _root.cam_.step;
- }
- _root.cam = {x:_root.cam_.x, y:_root.cam_.y, z:_root.cam_.z};
- _root.camxtxt.text = _root.cam_.x+" ::"+_root.cam_.y+" ::"+_root.cam_.z;
- _root.drawMethod.flush();
- _root.drawMethod.render(_root.meshObject, _root.viewport, _root.origine, _root.cam);
- }, 50);
- }
- };
var file:String = "pyramide.fobj";
var origine:Object;
var cam:Object;
var viewport:Number;
var meshObject:Array;
var xmlObject:XML = new XML();
var cam_:Object = {x:0, y:0, z:98, step:0.2};
var meshBuilder = new mesh();
var drawMethod = new draw(_root);
origine = {x:300, y:200};
viewport = 52;
xmlObject.ignoreWhite = true;
xmlObject.load(file);
xmlObject.onLoad = function(flag) {
if (flag) {
// si vous chargez au format xml:
//_root.meshObject = meshBuilder.loadMeshFromXML(this);
_root.meshObject = _root.meshBuilder.loadMeshFromDataFile(this);
_root.drawMethod.setFill(40, 0x336699);
_root.drawMethod.setLine(100, 0x000000, -1);
setInterval(function () {
if (Key.isDown(Key.LEFT)) {
_root.cam_.x -= _root.cam_.step;
}
if (Key.isDown(Key.RIGHT)) {
_root.cam_.x += _root.cam_.step;
}
if (Key.isDown(Key.UP)) {
_root.cam_.y -= _root.cam_.step;
}
if (Key.isDown(Key.DOWN)) {
_root.cam_.y += _root.cam_.step;
}
if (Key.isDown(Key.PGUP)) {
_root.cam_.z -= _root.cam_.step;
}
if (Key.isDown(Key.PGDN)) {
_root.cam_.z += _root.cam_.step;
}
_root.cam = {x:_root.cam_.x, y:_root.cam_.y, z:_root.cam_.z};
_root.camxtxt.text = _root.cam_.x+" ::"+_root.cam_.y+" ::"+_root.cam_.z;
_root.drawMethod.flush();
_root.drawMethod.render(_root.meshObject, _root.viewport, _root.origine, _root.cam);
}, 50);
}
};