here a ruw sample from the quick demo I've sended you earlyer. 
where white was no hit, black hit. Say very simple primary ray raytracer.

private function someImage():void
                {
                        
                        _tracemap.lock();
                        
                        var intersectP:Number3D;
                        
                        var i:int;
                        var j:int;
                        var k:int;
                        var l:int;
                        
                        var r:int = 255;
                        var g:int = 255;
                        var b:int = 255;
                         
                        var startx:int = _view.x-Math.round(_width*.5);
                        var starty:int =_view.y-Math.round(_height*.5)
                        var pixel:Number3D;
                        
                        var meshlength:int = _meshes.length;
                        
                        var faces:Vector.<Number3D>;
                        var faceslength:int;
                
                        for(i = 0; i<_width;++i){
                                startx++;
                                for(j = 0; j<_height;++j){
                                        pixel = _view.camera.unproject(startx, 
starty+j);
                                         
                                        _dir.x = pixel.x;
                                        _dir.y = pixel.y;
                                        _dir.z = pixel.z;
                                        _dir.normalize();
                                         
                                        for(k = 0; k<meshlength;++k){
                                                
                                                faces = _meshes[k];
                                                faceslength = faces.length;
                                                
                                                for(l = 0; l<faceslength;l+=3){
                                                        intersectP = 
_ray.getIntersect(_dir, pixel, faces[l], faces[l+1], faces[l+2]);
                                                        
RayDebugger.traceRayFromDir(pixel, _dir, 2500);
                                                        if (intersectP != null)
                                                                
_tracemap.setPixel(i, j,  r << 16 | g  << 8 | b );
                                                }
                                        }
                                }
                        }
                        
                        _tracemap.unlock();

                        [... some uninterresting code...]

Fabrice


 
On Aug 25, 2010, at 4:06 PM, Michael Iv wrote:

> Got you , no I haven't seen the FITC presentation yet . By the way ,still 
> can't get ray.getIntersect() returning the data besides null.
> If you could show some source code if a test run it could be nice.Although I 
> am almost sure I do it just as it has to be .
> 
> Thanks a lot .
> Michael.
> 
> On Wed, Aug 25, 2010 at 5:00 PM, Fabrice3D <[email protected]> wrote:
> As usual works just fine for me :))
> I haven't added it exactly for what I suppose you want to do.
> It was added to allow the retrieving of uv's,map,meshname from a hittest 
> result performed by the BSP.
> Look at BSPHittest code if you want to see how the class was used.
> (If you have followed the livestream from FITC where Rob showed the FPS demo 
> we've builded, then you know now how the rockets were builded.)  :)
> 
> If you ensure that the position you test on is a result of a plane/ray hitest 
> where the position is on the "plane" of the triangle
> then it should result in what you need: that is being used as test point in 
> triangle. UV returned would be null if not inside.
> 
> I wouldn't be honest not adding that I think very soon make some speed 
> compairs with the ray intersect implementation I have in Prefab replaced with 
> this class...
> so the class might evolve bits.
> 
> Fabrice
> 
> 
> On Aug 25, 2010, at 3:12 PM, Michael Iv wrote:
> 
>> hey Fabrice , is BaryCentricTest is like Ray.getIntersect() but  for UV  
>> coords >?
>> 
>> Doest it work fine ? (Unlike Ray.getIntersect() ;)  );
>> BaryCentricTest
>> 
>> 
>> On Wed, Aug 25, 2010 at 3:33 PM, Fabrice3D <[email protected]> wrote:
>> http://code.google.com/p/away3d/source/browse/#svn/trunk/fp10/Away3D/src/away3d/tools/utils
>> 
>> here you go.
>> 
>> Fabrice
>> On Aug 25, 2010, at 2:18 PM, Bobby wrote:
>> 
>> > Hi Edwin,
>> >      I am using the away3d_2_5_0 version. I have the away3d_3_5_0
>> > also with me. But in both these I cannot find utils folder with the
>> > tools package. How can I overcome this error. I am using the
>> > downloaded zip files from the Away 3D site. I am not using SVN. Is
>> > that causing the problem. CAN ANYONE HELP ME !!!!!!!!!!!!!!
>> >
>> > Thanks in Advance
>> > Bobby Francis Joseph
>> 
>> 
>> 
>> 
>> -- 
>> Michael Ivanov ,Programmer
>> Neurotech Solutions Ltd.
>> Flex|Air |3D|Unity|
>> www.neurotechresearch.com
>> http://blog.alladvanced.net
>> http://www.meetup.com/GO3D-Games-Opensource-3D/
>> Tel:054-4962254
>> [email protected]
>> [email protected]
>> 
> 
> 
> 
> 
> -- 
> Michael Ivanov ,Programmer
> Neurotech Solutions Ltd.
> Flex|Air |3D|Unity|
> www.neurotechresearch.com
> http://blog.alladvanced.net
> http://www.meetup.com/GO3D-Games-Opensource-3D/
> Tel:054-4962254
> [email protected]
> [email protected]
> 

Reply via email to