actionscript 3 - Very small 3d rendering -
actionscript 3 - Very small 3d rendering -
i'm writing little piece of code on 3d model rendition based on post: http://active.tutsplus.com/tutorials/3d/quick-tip-displaying-a-3d-model-with-papervision3d/
i downloaded free dae file (car_shell_001.dae) , texture (vehicle_texture.jpg).
i copied code example, changing file pointer files. here's code:
public class tarini extends basicview { [embed(source="assets/car_shell_001.dae", mimetype="application/octet-stream")] private var bikemodelclass:class; [embed(source="./assets/vehicle_texture.jpg")] private var biketextureclass:class; private var bikemodeldae:dae; public function tarini() { this.loaderinfo.addeventlistener ( event.complete, onfullyloaded ) ; } private function onfullyloaded(e:event):void { var bitmap:bitmap = new biketextureclass ( ) ; var bitmapmaterial:bitmapmaterial = new bitmapmaterial ( bitmap.bitmapdata ) ; var materialslist:materialslist = new materialslist ( ) ; materialslist.addmaterial ( bitmapmaterial, "all" ) ; var bytearray:bytearray = new bikemodelclass ( ) ; bikemodeldae = new dae ( ) ; bikemodeldae.load ( bytearray, materialslist ) ; this.scene.addchild ( bikemodeldae ) ; this.camera.z = 500; this.startrendering ( ) ; } }
this simple , it. compile mxmlc , i've got no compilation errors. when open generated swf obtain veeeeery little rendition in centre of browser.
what's problem? need forcefulness dimensions in way? if think having dae , jpg file useful, tell me :)
it's mutual measurement units different between 3d engine , 3d editor (actually between editor can observe that: export cube blender illustration , check in sketchup/3dsmax/etc.)
simplest thing can scale model after initializing it:
bikemodeldae.scale = 10;//or other value works best
another valid alternative play photographic camera zoom/focus options. if have model display can utilize either method (object scale, photographic camera properties), if have multiple models, it's best create sure utilize similar scale between models.
a bit off topic, asume know papervision has not been updated since 2010. recommend trying engine still developed, away3d example.
actionscript-3 papervision3d
Comments
Post a Comment