I will try to find out why AS3.exe didn't work for me.
]]>AS3 isnt really any different from AS2, although it was rebuilt form ground up, its just certain things you have to get used to
movieclip properties for a first
_x is not just x, _y = y, _ymouse = mouseY, _xmouse = mouseX _xscale = scaleX _yscale = scaleY
one of the biggest changes is in clip handlers like onEnterFrame and stuff, they are now events.
import flash.events.*;
function main(event:Event):void
{
}
addEventListener(Event.ENTER_FRAME,main);
but you get used it to it pretty easily.
one of the most annoying changes, is in the Key class, well, there isnt one for a start, with the ui package you have Keyboard, but the functionallity of Key.isDown has been removed
however in AS2, onKeyDown and onKeyUp events, werent very good, handling them, if you held down one key, onKeyDown would be triggered with it, then you keep that held down, then press another onKeyDown is triggered, but onKeyUp was only triggered for the second key, they are working perfectly now, and so you can create youre own isDown functions without any loss of functionality
for example, i made my own little class for isDown and isUp functionality
package delta.ui
{
import flash.events.KeyboardEvent;
public class Key
{
private var keys:Array;
private function downhandle(obj:KeyboardEvent):void
{
keys[obj.keyCode] = true;
}
private function uphandle(obj:KeyboardEvent):void
{
keys[obj.keyCode] = false;
}
public function isDown(keyCode:uint, ...keyCodes):Boolean
{
if(keyCodes.length==0)
return keys[keyCode];
else
{
if(!keys[keyCode]) return false;
for(var i:uint = 0; i<keyCodes.length; ++i)
{
if(!keys[keyCodes[i]]) return false;
}
return true;
}
}
public function isUp(keyCode:uint, ...keyCodes):Boolean
{
if(keyCodes.length==0)
return !keys[keyCode];
else
{
if(keys[keyCode]) return false;
for(var i:uint = 0; i<keyCodes.length; ++i)
{
if(keys[keyCodes[i]]) return false;
}
return true;
}
}
public function Key(stage:Object):void
{//its imperative that 'stage' is passed to the constructor for the class to work
keys = new Array(222);
stage.addEventListener(KeyboardEvent.KEY_DOWN,downhandle,false,0,true);
stage.addEventListener(KeyboardEvent.KEY_UP,uphandle,false,0,true);
}
}
}
and its just the same to use, if not better in a way
import delta.ui.Key;
import flash.ui.Keyboard;
var keyhand:Key = new Key(stage);
if(keyhand.isDown(Keyboard.UP,Keyboard.DOWN,Keyboard.LEFT,Keyboard.RIGHT)) {}
and that will only trigger, if UP,DOWN,LEFT and RIGHT are all pressed down.
there are certain things like the new int datatype which is very nice, however, if you start using AS3 anytime soon, DO NOT use the uint data type, (unsigned int) for some strange reason, it is incredibly slow, dont use it unless you absolutely have to
in terms of speed, if you run a simple iteration loop from 0 to 100000000, just like var i∫; for(i=0;i<100000000;i+=1) {}
you get execution times of around int = 512ms, Number = 2136ms, and uint = 3245ms
uint is for some reason icnredibly slow, and there are many other speed things ive tried
for some reason, i+=1 and i-=1 is alot faster than doing ++i, i++ or --i, i--;
you can see most of them here : http://newgrounds.com/bbs/topic.php?id=535196
alot of these do not apply to AS2 though, but these do apply to AS3
im not sure about my program crashing though, i dont know why that might be, unless you absolutely cannot use openGL, although i havnt used it in the 3d rendering, i am using openGL to display the rendering as a texture on a single quad since its alot faster than using win32 and SetPixel
]]>What you say implies it aint so good, what have you discovered so far?
And how is it programming in AS3 ... is it well written?
(AS3.exe didn't work for me - just bombed out)
]]>anyone that doesnt know, software rendering general refers to the rendering of 3d graphics, by a piece of software, rather than the graphics card, being hardware rendering, so that all the rendering has to be done manually, without the help of openGL or directX or any other graphics api
i havnt added near plane clipping yet, but i have made a little sample with a model of a cube spinning around, and duplicated 8 times into a little 3x3 grid of differently rotating cubes. So far you can input in the source code, model data via creating a new model, and inputting its triangle data and texture data for the triangles, and then you can move the models around and rotate them, duplicate them, and it has a camera, in terms of rendering, obviously texturing, which is perspective correct, with a zbuffer and back face culling of triangles
it does have a virtual camera in it, but theres no interface for moving or rotating it yet:p
http://delta-luca.110mb.com/AS3.zip
you need windows to run the program, counting the triangles, there are 108 triangles in total, 2 per each face of a cube, 12 triangles a cube, 9 cubes
----------------edit
ive now added per pixel lighting with a single light placed below and towards camera a bit
]]>