Jon,
There is really no api documentation - im looking to release the
code line into the community or basically
just keep this internal. I've done alot of work into getting the
framerate acceptable without hitting the CPU dramatically.
Each TdObject is a container which can have either other TdObjects
and/or has points & vertexes
I handle clipping in two forms,
inside a TdObject this is performed on a vertex level. This also
presents the luminosity process too
between TdObjects in the container (children so to speak) clipping
is done on the local translated coordinate
of (0,0,0)
The demo that i presented earlier is composed of the following code...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:threed="com.imathome.code.threed.*"
layout="absolute"
backgroundGradientColors="[0xffffffff,0xffffffff]"
initialize="init()"
xmlns:media="flash.media.*"
xmlns:core="com.imathome.code.core.*">
<mx:Script>
<![CDATA[
private var $netConnection:NetConnection = null;
private var $netStream:NetStream = null;
private var $video:Video = new Video();
protected function init():void {
myVid1.vertexes[0].texture = "vid";
myVid2.vertexes[0].texture = "vid";
myVid3.vertexes[0].texture = "vid";
myVid4.vertexes[0].texture = "vid";
myVid1.vertexes[0].drawSurface = false;
myVid2.vertexes[0].drawSurface = false;
myVid3.vertexes[0].drawSurface = false;
myVid4.vertexes[0].drawSurface = false;
$netConnection = new NetConnection();
$netConnection.objectEncoding =
ObjectEncoding.AMF3;
$netConnection.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
$netConnection.connect("rtmp://.....");
}
protected function onCuePoint(e:Object):void {};
protected function onMetaData(e:Object):void {};
protected function onPlayStatus(e:Object):void {};
protected function
netStreamStatus(_event:NetStatusEvent):void {
switch(_event.info.code){
case "NetStream.Buffer.Full": {
myVid1.addTexture("vid", $video, new
Rectangle(160,0,160,120));
myVid2.addTexture("vid",
$video, new Rectangle(0,0,160,120));
myVid3.addTexture("vid",
$video, new Rectangle(0,120,160,120));
myVid4.addTexture("vid", $video, new
Rectangle(160,120,160,120));
addEventListener(Event.ENTER_FRAME, vidWall.redraw);
break;
}
case "NetStream.Buffer.Empty":
case "NetStream.Buffer.Flush":
case "NetStream.Play.Start":
case "NetStream.Play.Stop":
case "NetStream.Play.Failed":
case "NetStream.Play.Reset": {
myVid1.textures.clear();
myVid2.textures.clear();
myVid3.textures.clear();
myVid4.textures.clear();
removeEventListener(Event.ENTER_FRAME,
vidWall.redraw);
break;
}
}
}
protected function
netStatusHandler(_event:NetStatusEvent):void
{
switch( _event.info.code ) {
case "NetConnection.Connect.Success": {
$netStream = new NetStream(
$netConnection );
$netStream.bufferTime = 2;
$netStream.addEventListener(NetStatusEvent.NET_STATUS,
netStreamStatus);
var _clientObject:Object = new
Object();
_clientObject.onCuePoint = onCuePoint;
_clientObject.onMetaData =
onMetaData;
_clientObject.onPlayStatus =
onPlayStatus;
$video.attachNetStream($netStream);
$netStream.client =
_clientObject;
$netStream.play("music/remlosingmyreligion");
break;
}
case "NetConnection.Connect.Closed":
case "NetConnection.Connect.Rejected":
case "NetConnection.Connect.Failed":
{
if ($netConnection != null) {
if ($netStream != null)
{
$netStream.removeEventListener(NetStatusEvent.NET_STATUS,
netStreamStatus);
$netStream.close();
$netStream =
null;
}
$netConnection.close();
$netConnection.removeEventListener( NetStatusEvent.NET_STATUS,
netStatusHandler );
$netConnection = null;
}
break;
}
default:
trace("error found = " + _event.info.code);
break;
}
}
]]>
</mx:Script>
<threed:TdController tdWorld="{vidWall}" allowMoving="true"
moveMode="0" doRedraw="true" />
<threed:TdObject id="vidWall" d="{new Point(7,7) }" width="400"
height="400" size="400" x="{(width - vidWall.width) /2}" y="{(height
- vidWall.height) /2}" >
<threed:TdRectangle local="[ 2.01,-1.51,0.1]" id="myVid1"
lineSize="0" objectType="2" renderBack="true" dimensions="[4.0, 3.0,
0]" />
<threed:TdRectangle local="[-2.01,-1.51,-0.3]" id="myVid2"
lineSize="0" objectType="2" renderBack="true" dimensions="[4.0, 3.0,
0]" />
<threed:TdRectangle local="[-2.01, 1.51,0.2]" world="[0,0,0.2]"
id="myVid3" lineSize="0" objectType="2" renderBack="true"
dimensions="[4.0, 3.0, 0]" />
<threed:TdRectangle local="[ 2.01, 1.51,0]" id="myVid4"
lineSize="0" objectType="2" renderBack="true" dimensions="[4.0, 3.0,
0]" />
</threed:TdObject>
</mx:Application>
If you note, the TdRectangle classes are very straightforward to
understand...
As for a test / non-commercial license - i haven't got around yet to
putting in place such stringent measures.
The Adobe/Flex team are working indeed on acceleration routines
which is really notable and so before-long this work is going to be
pretty
worthless so im asking if there are any interested parties wishing
to help on making this a bit more robust.
Of course, there are god know how many 3D engines out there with god
knows whatever great options. Im purely interested
in advancing the knowledge out there and by developing the scene - I
dont know many of the 3D engines that actually publish
their code?
Regards
Samuel
On Sep 25, 2008, at 5:58 PM, Jon Oxtoby wrote:
Dear Samuel,
I just saw your 3D engine listed on flexcoders and would like to
know a bit more about it. One of the main issues I run into with
PV3D is z-fighting with intersecting planes - if your engine is an
improvement over pv3d in this area I'd be very interested to learn
more. I assume you have a full api and documentation for the engine
- is there a test / non-commercial license available?
Thanks,
Jon