3Dmember.image 2004-02-11 - By Lucas Meijer
Back Found the code I've used in the bathroom design app to render a highres 3d. I think all those updatestage's are there from some testing and might have never been taken out, not sure if you actually need 4. This assumes you have a 800x600 viewport
on renderHighres3d(tW3D,tRect) tBackupStageRect=(the stage).rect.duplicate() tBackupDrawRect=(the stage).drawRect -- (the stage).rect=rect(0,0,800,600) (the stage).drawrect=rect(0,0,800,600) the stagecolor=the stagecolor
tBackupFrame=the frame mach8_go("printscreen") tSprite=script("sprite").new([#name:"printsprite",#range:["printscreen"]])
tSprite.setMember(tW3D) tStageWidth=(the stage).rect.width tStageHeight=(the stage).rect.height
tSprite.setWidth(tRect.width) tSprite.setHeight(tRect.height)
tBackupRegpoint=tW3D.regpoint tW3D.regpoint=point(0,0) tSprite.setLoc(point(0,0))
tOldDTS=tW3D.directToStage tW3D.directToStage=0
tImage=image(tRect.width,tRect.height,16)
tStageRect=rect(0,0,tStageWidth,tStageHeight)
if the shiftdown then tDebug=1 end if
repeat while 1=1 repeat while 1=1
if tDebug then tRandom=rgb(random(255),random(255),random(255)) repeat with i=1 to tW3D.shader.count tW3d.shader[i].ambient=rgb(0,0,0) tW3d.shader[i].diffuse=rgb(0,0,0) tW3d.shader[i].specular=rgb(0,0,0) tW3d.shader[i].emissive=tRandom end repeat end if
-- for some reason need to do 3 in order for reflections etc to setup correctly. updatestage updatestage updatestage updatestage
if tDebug then repeat while the shiftdown=0 end repeat repeat while the shiftdown=1 end repeat end if
tSnapRect=tSprite.getRect().intersect(tStageRect) t=-tSprite.getLoc() tImage.copyPixels((the stage).image,tSnapRect.offset(t[1],t[2]),tSnapRect,[#ink:36,#bgcolor:rgb(0,0 ,102)])
if tSprite.getRight()<=tStageWidth then tSprite.setLocH(0) exit repeat end if tSprite.setLocH(tSprite.getLocH()-tStageWidth)
end repeat if tSprite.getBottom()<=tStageHeight then exit repeat tSprite.setLocV(tSprite.getLocV()-tStageHeight) end repeat
tSprite=tSprite.destroy() tW3D.directToStage=tOldDTS
(the stage).rect=tBackupStageRect (the stage).drawRect=tBackupDrawRect
--rob 1.0.1 21012003 printbug some users, uncommented next line
--getRendererServices().renderer=tBackup
tW3D.regpoint=tBackupRegpoint
mach8_go(tBackupFrame) return tImage end __ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|