[prev in list] [next in list] [prev in thread] [next in thread] 

List:       osflash-sandy
Subject:    Re: [Sandy] [sandy commit] r1058 - - ALightAttributes should use
From:       Russell Weir <damonsbane () gmail ! com>
Date:       2009-04-17 21:03:16
Message-ID: fb1c4a8b0904171403r5733c278w6b95ac9c73c5ccf2 () mail ! gmail ! com
[Download RAW message or body]

I was considering the fact that since sandy is distributed via haxelib, then
the user
has already used haxelib. Cpp does have full 32 bit, so that's not a
problem.  I put
the typedef into HaxeTypes (which should still be renamed "Defines.hx",
if you're looking for work ;) ), and only neko has it typed to I32, so on
other
archs, there's no requirement.

1) Require lib I32, code Int32 sections as I had done.
2) Only wrap for neko.

I think the second choice is probably the best, as you pointed out. The only
concern I had at the time is that by _not_ requiring it, the Int32 type will
not
get used where it should be. (ARGB colors etc.) which makes porting to
neko more difficult. However, after doing a bunch of work on Neash and Nme
the past couple days, Neko is certainly a less viable target than I had
hoped, since even the fact that Int member vars are initialized to Null's
is causing huge headaches for me when trying to compile and run demos.

R




On Fri, Apr 17, 2009 at 5:45 AM, Niel Drummond <niel.drummond@grumpytoad.org
> wrote:

> On Fri, Apr 17, 2009 at 04:42:54AM -0600, Russell Weir wrote:
> > This will compile and run on all architectures, except neko, without
> change.
> > Only when someone gets around to actually wanting to run the code on
> > a 31 bit platform will the 3 lines need to be changed to use I32 static
> > functions,
> > which incur no performance overhead on any architecture except the 31 bit
> > one.
> >
> > So, yeah... I think it's just easier to say... install and link I32.
>
> uhm, ok, just thinking about our users who may not have haxelib installed,
> or know how
> to use it. plus we do not package and release I32 with sandy, which is
> effectively required
> now for all targets, although AFAIK only neko uses it, or does C++ not have
> native 32-bit
> Integers ?
>
> - Niel
>
> >
> > R
> >
> >
> > On Fri, Apr 17, 2009 at 3:19 AM, Niel Drummond <
> niel.drummond@grumpytoad.org
> > > wrote:
> >
> > > On Thu, Apr 16, 2009 at 04:08:20PM -0600, Russell Weir wrote:
> > > > I32 should not have to be wrapped. Did you install the lib?
> > > > -lib I32
> > > > Since it's not specifically neko, as CPP is the target I'm trying
> > > > to get working eventually. The I32 lib should work flawlessly in
> > > > Javascript just as it does in flash.
> > >
> > > no I hadn't installed it, thanks for the tip and is fine by me for the
> > > javascript target,
> > >  yet I think we shouldn't need external libs for the flash target..
> what do
> > > you think ?
> > >
> > > - Niel
> > >
> > > >
> > > > R
> > > >
> > > > On Thu, Apr 16, 2009 at 2:43 PM, <codesite-noreply@google.com>
> wrote:
> > > >
> > > > > Author: cyanescent
> > > > > Date: Thu Apr 16 13:29:46 2009
> > > > > New Revision: 1058
> > > > >
> > > > > Modified:
> > > > >
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/AnimatedShape3D.hx
> > > > >
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/KeyFramedTransformGroup.hx
> > > > >   trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/TagCollection.hx
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/materials/attributes/ALightAttributes.hx
> > > > >   trunk/sandy/haxe/trunk/src/sandy/parser/ColladaParser.hx
> > > > >   trunk/sandy/haxe/trunk/src/sandy/parser/MD3Parser.hx
> > > > >   trunk/sandy/haxe/trunk/src/sandy/primitive/KeyFramedShape3D.hx
> > > > >   trunk/sandy/haxe/trunk/src/sandy/primitive/MD3.hx
> > > > >
> > > > > Log:
> > > > > - ALightAttributes should use new CoordinateSpace enum
> > > > > - More javascript runtime bugs caused by explicit cast
> > > > > - wrap 31-bit Integer handling code into neko conditional
> compilation
> > > > > - Fix Collada image loading: javascript event handling is
> immediate,
> > > flash
> > > > > is not,
> > > > >
> > > > >
> > > > >
> > > > > Modified:
> > > > > trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/AnimatedShape3D.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > ---
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/AnimatedShape3D.hx
> > > > > (original)
> > > > > +++
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/AnimatedShape3D.hx
> > > Thu
> > > > > Apr 16 13:29:46 2009
> > > > > @@ -443,10 +443,10 @@
> > > > >        private function __setFrameUpdateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).frameUpdateBounds =
> > > v;
> > > > > +                               cast(c).frameUpdateBounds = v;
> > > > >                        }
> > > > >                        else if(Std.is(c,AnimatedShape3D)) {
> > > > > -
> > > cast(c,AnimatedShape3D).frameUpdateBounds =
> > > > > v;
> > > > > +                               cast(c).frameUpdateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bFrameUpdateBounds = v;
> > > > > @@ -459,10 +459,10 @@
> > > > >        private function __setInterpolateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).interpolateBounds =
> > > v;
> > > > > +                               cast(c).interpolateBounds = v;
> > > > >                        }
> > > > >                        else if(Std.is(c,AnimatedShape3D)) {
> > > > > -
> > > cast(c,AnimatedShape3D).interpolateBounds =
> > > > > v;
> > > > > +                               cast(c).interpolateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bInterpolateBounds = v;
> > > > >
> > > > > Modified:
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/KeyFramedTransformGroup.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > ---
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/KeyFramedTransformGroup.hx
> > > > >     (original)
> > > > > +++
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/KeyFramedTransformGroup.hx
> > > > >     Thu Apr 16 13:29:46 2009
> > > > > @@ -216,7 +216,7 @@
> > > > >        private function __setFrameUpdateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).frameUpdateBounds =
> > > v;
> > > > > +                               cast(c).frameUpdateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bFrameUpdateBounds = v;
> > > > > @@ -229,7 +229,7 @@
> > > > >        private function __setInterpolateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).interpolateBounds =
> > > v;
> > > > > +                               cast(c).interpolateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bInterpolateBounds = v;
> > > > >
> > > > > Modified:
> > > trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/TagCollection.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > ---
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/TagCollection.hx
> > > > > (original)
> > > > > +++
> trunk/sandy/haxe/trunk/src/sandy/core/scenegraph/TagCollection.hx
> > > Thu
> > > > > Apr 16 13:29:46 2009
> > > > > @@ -181,7 +181,7 @@
> > > > >        private function __setFrameUpdateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).frameUpdateBounds =
> > > v;
> > > > > +                               cast(c).frameUpdateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bFrameUpdateBounds = v;
> > > > > @@ -194,7 +194,7 @@
> > > > >        private function __setInterpolateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).interpolateBounds =
> > > v;
> > > > > +                               cast(c).interpolateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bInterpolateBounds = v;
> > > > > @@ -210,4 +210,4 @@
> > > > >        //--
> > > > >        private var m_bFrameUpdateBounds : Bool;
> > > > >        private var m_bInterpolateBounds : Bool;
> > > > > -}
> > > > > \ No newline at end of file
> > > > > +}
> > > > >
> > > > > Modified:
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/materials/attributes/ALightAttributes.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > ---
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/materials/attributes/ALightAttributes.hx
> > > > >     (original)
> > > > > +++
> > > > >
> > >
> trunk/sandy/haxe/trunk/src/sandy/materials/attributes/ALightAttributes.hx
> > > > >     Thu Apr 16 13:29:46 2009
> > > > > @@ -262,7 +262,7 @@
> > > > >                m_oL = p_oScene.light.getDirectionPoint3D ();
> > > > >
> > > > >                // fetch camera vector
> > > > > -               m_oV = p_oScene.camera.getPosition ("absolute");
> > > m_oV.scale
> > > > > (-1); m_oV.normalize ();
> > > > > +               m_oV = p_oScene.camera.getPosition (ABSOLUTE);
> > > m_oV.scale
> > > > > (-1); m_oV.normalize ();
> > > > >
> > > > >                // compute Blinn halfway vector
> > > > >                m_oH.copy( m_oL ); m_oH.add (m_oV); m_oH.normalize
> ();
> > > > >
> > > > > Modified: trunk/sandy/haxe/trunk/src/sandy/parser/ColladaParser.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > --- trunk/sandy/haxe/trunk/src/sandy/parser/ColladaParser.hx
> > >  (original)
> > > > > +++ trunk/sandy/haxe/trunk/src/sandy/parser/ColladaParser.hx    Thu
> Apr
> > > 16
> > > > > 13:29:46 2009
> > > > > @@ -103,7 +103,7 @@
> > > > >                }
> > > > >
> > > > >                if( m_oCollada.hasNode.library_images )
> > > > > -                       m_oMaterials = loadImages(
> > > > > m_oCollada.node.library_images.nodes.image );
> > > > > +                       loadImages(
> > > > > m_oCollada.node.library_images.nodes.image );
> > > > >                else
> > > > >                        parseScene(
> > > > > m_oCollada.node.library_visual_scenes.node.visual_scene );
> > > > >        }
> > > > > @@ -772,7 +772,7 @@
> > > > >        }
> > > > >
> > > > >
> > > > > -       private function loadImages( p_oLibImages : List<FastXml> )
> :
> > > > > Hash<ColladaImage>
> > > > > +       private function loadImages( p_oLibImages : List<FastXml> )
> :
> > > Void
> > > > >        {
> > > > >                var l_oImages : Hash<ColladaImage> = new Hash();
> > > > >                var l_oQueue : LoaderQueue = new LoaderQueue();
> > > > > @@ -792,10 +792,11 @@
> > > > >                                new URLRequest(
> RELATIVE_TEXTURE_PATH +
> > > "/"
> > > > > + l_oImages.get( l_sId ).fileName )
> > > > >                        );
> > > > >                }
> > > > > +
> > > > > +               m_oMaterials = l_oImages;
> > > > >                l_oQueue.addEventListener(
> QueueEvent.QUEUE_COMPLETE,
> > > > > imageQueueCompleteHandler );
> > > > >                l_oQueue.start();
> > > > >
> > > > > -               return l_oImages;
> > > > >        }
> > > > >
> > > > >        private function imageQueueCompleteHandler( p_oEvent :
> > > QueueEvent )
> > > > > : Void
> > > > >
> > > > > Modified: trunk/sandy/haxe/trunk/src/sandy/parser/MD3Parser.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > --- trunk/sandy/haxe/trunk/src/sandy/parser/MD3Parser.hx
> > >  (original)
> > > > > +++ trunk/sandy/haxe/trunk/src/sandy/parser/MD3Parser.hx        Thu
> Apr
> > > 16
> > > > > 13:29:46 2009
> > > > > @@ -95,8 +95,13 @@
> > > > >                event.percent = 80;
> > > > >                dispatchEvent( event );
> > > > >
> > > > > +#if neko
> > > > >                ident = I32.toInt(data.readInt());
> > > > >                version = I32.toInt(data.readInt());
> > > > > +#else
> > > > > +               ident = data.readInt();
> > > > > +               version = data.readInt();
> > > > > +#end
> > > > >                if (ident != MD3.MAGIC || version != 15)
> > > > >                        throw "Error loading MD3 file: Not a valid
> MD3
> > > > > file/bad version";
> > > > >                var fname = KeyFramedShape3D.readCString(data,
> > > > > MD3.MAX_QPATH);
> > > > > @@ -104,6 +109,7 @@
> > > > >                        this.name = m_sDefaultName;
> > > > >                else
> > > > >                        this.name = fname;
> > > > > +#if neko
> > > > >                var flags = I32.toInt(data.readInt());
> > > > >                num_frames = I32.toInt(data.readInt());
> > > > >                num_tags = I32.toInt(data.readInt());
> > > > > @@ -113,6 +119,17 @@
> > > > >                offset_tags = I32.toInt(data.readInt());
> > > > >                offset_surfaces = I32.toInt(data.readInt());
> > > > >                offset_end = I32.toInt(data.readInt());
> > > > > +#else
> > > > > +               var flags = data.readInt();
> > > > > +               num_frames = data.readInt();
> > > > > +               num_tags = data.readInt();
> > > > > +               num_surfaces = data.readInt();
> > > > > +               num_skins = data.readInt();
> > > > > +               offset_frames = data.readInt();
> > > > > +               offset_tags = data.readInt();
> > > > > +               offset_surfaces = data.readInt();
> > > > > +               offset_end = data.readInt();
> > > > > +#end
> > > > >
> > > > >                #if debug
> > > > >                trace("MD3Parser '" + name + "'");
> > > > > @@ -212,7 +229,7 @@
> > > > >                }
> > > > >                // reset all frame counters
> > > > >                for(c in tg.children)
> > > > > -                       cast(c,IKeyFramed).frame = 0;
> > > > > +                       cast(c).frame = 0;
> > > > >                // --
> > > > >                dispatchInitEvent ();
> > > > >        }
> > > > >
> > > > > Modified:
> > > trunk/sandy/haxe/trunk/src/sandy/primitive/KeyFramedShape3D.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > --- trunk/sandy/haxe/trunk/src/sandy/primitive/KeyFramedShape3D.hx
> > > > >  (original)
> > > > > +++ trunk/sandy/haxe/trunk/src/sandy/primitive/KeyFramedShape3D.hx
> > >  Thu
> > > > > Apr 16 13:29:46 2009
> > > > > @@ -372,7 +372,7 @@
> > > > >        private function __setFrameUpdateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).frameUpdateBounds =
> > > v;
> > > > > +                               cast(c).frameUpdateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bFrameUpdateBounds = v;
> > > > > @@ -385,7 +385,7 @@
> > > > >        private function __setInterpolateBounds(v:Bool) : Bool {
> > > > >                for(c in children) {
> > > > >                        if(Std.is(c, IKeyFramed)) {
> > > > > -
> cast(c,IKeyFramed).interpolateBounds =
> > > v;
> > > > > +                               cast(c).interpolateBounds = v;
> > > > >                        }
> > > > >                }
> > > > >                return m_bInterpolateBounds = v;
> > > > > @@ -439,4 +439,4 @@
> > > > >        private var m_bFrameUpdateBounds : Bool;
> > > > >        private var m_bInterpolateBounds : Bool;
> > > > >
> > > > > -}
> > > > > \ No newline at end of file
> > > > > +}
> > > > >
> > > > > Modified: trunk/sandy/haxe/trunk/src/sandy/primitive/MD3.hx
> > > > >
> > > > >
> > >
> ==============================================================================
> > > > > --- trunk/sandy/haxe/trunk/src/sandy/primitive/MD3.hx   (original)
> > > > > +++ trunk/sandy/haxe/trunk/src/sandy/primitive/MD3.hx   Thu Apr 16
> > > 13:29:46
> > > > > 2009
> > > > > @@ -95,6 +95,7 @@
> > > > >                var offset_begin = data.position;
> > > > >                data.endian = Endian.LITTLE_ENDIAN;
> > > > >
> > > > > +#if neko
> > > > >                var ident:Int = I32.toInt(data.readInt());
> > > > >                if (ident != MD3.MAGIC)
> > > > >                        throw "Error loading MD3 file: Magic number
> > > error
> > > > > loading surface. " + Std.string(ident);
> > > > > @@ -109,6 +110,22 @@
> > > > >                var offset_st = I32.toInt(data.readInt());
> > > > >                var offset_verts = I32.toInt(data.readInt());
> > > > >                var offset_surface_end = I32.toInt(data.readInt());
> > > > > +#else
> > > > > +               var ident:Int = data.readInt();
> > > > > +               if (ident != MD3.MAGIC)
> > > > > +                       throw "Error loading MD3 file: Magic number
> > > error
> > > > > loading surface. " + Std.string(ident);
> > > > > +               name = KeyFramedShape3D.readCString(data, 64);
> > > > > +               var flags = data.readInt();
> > > > > +               num_frames = data.readInt();
> > > > > +               var num_shaders = data.readInt();
> > > > > +               num_vertices = data.readInt();
> > > > > +               var num_tris = data.readInt();
> > > > > +               var offset_tris = data.readInt();
> > > > > +               var offset_shaders = data.readInt();
> > > > > +               var offset_st = data.readInt();
> > > > > +               var offset_verts = data.readInt();
> > > > > +               var offset_surface_end = data.readInt();
> > > > > +#end
> > > > >
> > > > >                #if debug
> > > > >                        trace("*** MD3: Found surface named " +
> name);
> > > > > @@ -181,9 +198,15 @@
> > > > >                // placeholders that are replaced during
> __setFrame()
> > > > >                for(i in 0...num_tris) {
> > > > >                        // clockwise in md3.
> > > > > +#if neko
> > > > >                        var a = I32.toInt(data.readInt());
> > > > >                        var c = I32.toInt(data.readInt());
> > > > >                        var b = I32.toInt(data.readInt());
> > > > > +#else
> > > > > +                       var a = data.readInt();
> > > > > +                       var c = data.readInt();
> > > > > +                       var b = data.readInt();
> > > > > +#end
> > > > >
> > > > >                        mesh.setVertex (a, 1, 0, 0);
> > > > >                        mesh.setVertex (b, 0, 1, 0);
> > > > >
> > > > > _______________________________________________
> > > > > Sandy mailing list
> > > > > Sandy@osflash.org
> > > > > http://osflash.org/mailman/listinfo/sandy_osflash.org
> > > > >
> > > > _______________________________________________
> > > > Sandy mailing list
> > > > Sandy@osflash.org
> > > > http://osflash.org/mailman/listinfo/sandy_osflash.org
> > >
> > > _______________________________________________
> > > Sandy mailing list
> > > Sandy@osflash.org
> > > http://osflash.org/mailman/listinfo/sandy_osflash.org
> > >
> > _______________________________________________
> > Sandy mailing list
> > Sandy@osflash.org
> > http://osflash.org/mailman/listinfo/sandy_osflash.org
>
> _______________________________________________
> Sandy mailing list
> Sandy@osflash.org
> http://osflash.org/mailman/listinfo/sandy_osflash.org
>
_______________________________________________
Sandy mailing list
Sandy@osflash.org
http://osflash.org/mailman/listinfo/sandy_osflash.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic