Papervision3D: Bitmap handle like FIVe3D

Starting from the example shown in FIVe3D: Bitmap treat , let's see how to achieve the same effect using Papervision3D 2.0 (Great White), as well as continue to analyze the operation of this beta Great White.

Loading Flash ...


The first difference we notice is in the size of the generated movie: 120K for Papervision against 80 of FIVe3D! However, it is more than understandable! With Papervision 3D rendering, we are making real! Simple, in this example, but expandable at will, unlike FIVe3D that, in practice, ends his work there where we left off. Also, as you will see from the code, we have "imported" parts of the library certainly more voluminous than those of FIVe3D:

1
2
3
4
5
papervision3d . events . InteractiveScene3DEvent ; import org. Papervision3D. events. InteractiveScene3DEvent;
papervision3d . materials .*; import org. Papervision3D. .* materials;
papervision3d . objects . DisplayObject3D ; import org. Papervision3D. objects. DisplayObject3D;
papervision3d . objects . primitives . Plane ; import org. Papervision3D. objects. primitives. Plane;
papervision3d . view . BasicView ; import org. Papervision3D. view. BasicView;

I propose here a document class PVBitmap , but you name it anything you like. In the library of movie I major PNG image to 256 × 256 pixels, exporting it with the usual name myimage :

1
new myimage ( 256 , 256 ) , true ) ; __mat1 BitmapMaterial = new (new myimage (256, 256), true);

Source Document class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package {
/ *
** @ Name: PVBitmap.as
** @ Description: Class Project
** @ Author: undo = =
** @ Web: http://www.undolog.com
** @ Email: @ g.fazioli undolog.com
**
** @ Ver: 1.0
* /
.*; import flash.display .*;
.*; import flash.events .*;

/ *
** Import Papervision3D 2.0
* /
papervision3d . events . InteractiveScene3DEvent ; import org. Papervision3D. events. InteractiveScene3DEvent;
papervision3d . materials .*; import org. Papervision3D. .* materials;
papervision3d . objects . DisplayObject3D ; import org. Papervision3D. objects. DisplayObject3D;
papervision3d . objects . primitives . Plane ; import org. Papervision3D. objects. primitives. Plane;
papervision3d . view . BasicView ; import org. Papervision3D. view. BasicView;

PVBitmap extends Sprite { PVBitmap public class extends Sprite {
/ / Pp3d
__bv : BasicView ; protected var __bv: BasicView;
__mat1 : BitmapMaterial ; protected var __mat1: BitmapMaterial;
__plane : Plane ; protected var __plane: Plane;
/ *
** Constructor
* /
PVBitmap function () {
Event . ADDED_TO_STAGE , init ) ; addEventListener ( Event . ADDED_TO_STAGE, init);
}
/ *
** Init ()
* /
init ( e : Event ) : void { protected function init (e: Event ): void {
initPapervision ();
initMaterials ();
initObjects ();
initListeners ();
}

/ *
** InitPapervision ()
* /
initPapervision ( ) : void { protected function initPapervision (): void {
640 , 480 , false , true ) ; __bv BasicView = new (640, 480, false, true);
__bv ) ; addChild (__bv);
zoom = 15 ; __bv. room. Zoom = 15;
}

/ *
** InitMaterials ()
* /
initMaterials ( ) : void { protected function initMaterials (): void {
/ / Create the image using the material in the library exported with the
/ / Name "myimage"
new myimage ( 256 , 256 ) , true ) ; __mat1 BitmapMaterial = new (new myimage (256, 256), true);
; __mat1. smooth = true;
; __mat1. doubleSided = true;
}

/ *
** InitObjects ()
* /
initObjects ( ) : void { protected function initObjects (): void {
__mat1 ) ; __plane = new Plane (__mat1);
addChild ( __plane ) ; __bv. scenes. addChild (__plane);
}

/ *
** InitListeners ()
* /
initListeners ( ) : void { protected function initListeners (): void {
Event . ENTER_FRAME , render ) ; addEventListener ( Event . ENTER_FRAME, render);
}

/ *
** @ Prototype
* /
render ( e : Event ) : void { private function render (e: Event ): void {
1 ) ; __plane. yaw (1);
; __bv. singleRender ();
}
}
}

, Scene3D , Camera3D e BasicRenderEngine . Note the use of the object BasicView instead of the classic Viewport3D , Scene3D , Camera3D and BasicRenderEngine . With one stroke, in fact, the objectivity BasicView instantiates all other items necessary to render.

Unlike FIVe3D then Papervision eplicita want the request to create a texture (or material) with double-sided:

1
; __mat1. doubleSided = true;

If you set doubleSided to false, in fact, during the rotation of the hidden face will not be made.

There are no comments for this post

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL