I've uploaded a picture "shadebacking.png"
You can see the result of the shade on the map on left and the texture
on the mesh.

the texture won't be drawn on my "pre backing"(don't laught...) before
the face is visible to the camera, that's why I get some holes in it.

here is a piece of (UGLY!!!!) code to understand the recursive:
for each drawTriangle (but maybe):

 protected function renderTriToMap(tri:DrawTriangle,
session:AbstractRenderSession, kar:Number, kag:Number, kab:Number,
kdr:Number, kdg:Number, kdb:Number, ksr:Number, ksg:Number,
ksb:Number):void
        {
            br = (kar + kag + kab + kdr + kdg + kdb + ksr + ksg + ksb)/
3;

            mapping = getMapping(tri);

                        var face:FaceVO = tri.faceVO;
                        var unfoldedX:Number = face.uv0.u * _bitmap.width;
                        var unfoldedY:Number = (1 - face.uv0.v) * 
_bitmap.height;

            v0 = tri.v0;
            v1 = tri.v1;
            v2 = tri.v2;

                var brightness:Number = ladder(br);
                var bitmap:BitmapData = cache[brightness];
                if (bitmap == null)
                {
                        bitmap = new BitmapData(_bitmap.width,
_bitmap.height, true, 0x00000000);
                        colorTransform.matrix = [brightness, 0, 0, 0, 0, 0,
brightness, 0, 0, 0, 0, 0, brightness, 0, 0, 0, 0, 0, 1, 0];
                        bitmap.applyFilter(_bitmap, bitmap.rect, bitmapPoint,
colorTransform);
                    cache[brightness] = bitmap;
                }
                                if(count%2 == 0){
                                _mapCache.graphics.lineStyle();
                                _mapCache.graphics.beginBitmapFill(bitmap);
                                _mapCache.graphics.lineTo(unfoldedX,unfoldedY);
                                
_mapCache.graphics.lineTo(unfoldedX+65,unfoldedY);
                                
_mapCache.graphics.lineTo(unfoldedX,unfoldedY+65);
                                _mapCache.graphics.endFill();}
                                else {
                                _mapCache.graphics.lineStyle();
                                
_mapCache.graphics.beginFill(0xFFFFFF*brightness);
                                
_mapCache.graphics.moveTo(unfoldedX+65,unfoldedY);
                                
_mapCache.graphics.lineTo(unfoldedX+65,unfoldedY+65);
                                
_mapCache.graphics.lineTo(unfoldedX,unfoldedY+65);
                                _mapCache.graphics.endFill();}
                                finalbitmap.draw(_mapCache,new Matrix());
            }
 }

2 centurys ago I'd have been burned alive for this drawing method,but
I failed using the face coord to draw triangle on the graphics...

Reply via email to