Hello à tous,
je viens de finir un cube en paper cependant à la publication ma texture "ondule" lors de la rotation .
Si vous avez des avis merci par avance
Hello à tous,
je viens de finir un cube en paper cependant à la publication ma texture "ondule" lors de la rotation .
Si vous avez des avis merci par avance
j'ai pas ce probleme avec papervision3D, comment tu rajoutes l'image (le code) ?
------
je crois que j'ai compris ton erreur, tu dois faire tourner la caméra autour de l'objet plutôt que d'appliquer la rotation a ton cube !
gaffe aussi a ne pas coller un bitmap sur une Shape/Sprite que tu utilises pour faire les faces
Les images je passe par un bitmapasset en faite car j'ai besoin d'avoir tout integrer dans le swf.
Cependant j'ai le même effet avec une rotation du cube
voila le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 package { import flash.events.Event; import flash.display.BitmapData; import org.papervision3d.materials.BitmapAssetMaterial; import org.papervision3d.materials.utils.MaterialsList; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.primitives.Cube; import org.papervision3d.view.BasicView; public class Main extends BasicView { private var cube:Cube; private var materialList:MaterialsList; private var frontMat:BitmapAssetMaterial; private var rightMat:BitmapAssetMaterial; private var leftMat:BitmapAssetMaterial; private var backMat:BitmapAssetMaterial; public function Main() { super(stage.stageWidth,stage.stageHeight,true,true); stage.frameRate = 40; init(); startRendering(); } private function init():void { //on definit la texture frontMat = new BitmapAssetMaterial("test",false); frontMat.smooth = true; rightMat = new BitmapAssetMaterial("test",false); rightMat.smooth = true; leftMat = new BitmapAssetMaterial("test",false); leftMat.smooth = true; backMat = new BitmapAssetMaterial("test",false); backMat.smooth = true; materialList = new MaterialsList(); materialList.addMaterial(frontMat,"front"); materialList.addMaterial(rightMat,"right"); materialList.addMaterial(leftMat,"left"); materialList.addMaterial(backMat,"back"); //cube = new Cube(materialsList,320,320,320); cube = new Cube(materialList); scene.addChild(cube); camera.z = -900; } override protected function onRenderTick(e:Event=null):void { super.onRenderTick(); //cube.yaw(0.3); cube.rotationY+=0.5; } } }
voici ma version :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 package { import flash.display.Bitmap; import flash.events.Event; import org.papervision3d.materials.BitmapMaterial; import org.papervision3d.materials.utils.MaterialsList; import org.papervision3d.objects.primitives.Cube; import org.papervision3d.view.BasicView; [SWF(width = "600", height = "400", backgroundColor = "#006699", frameRate = "30")] /** * ... * @author ... */ public class MainCubeMaterialImage extends BasicView { public function MainCubeMaterialImage():void { super(600,400,true); init(); } [Embed(source = '../lib/img1.png')] private static const Img:Class; private var _forme3D:Cube; private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point stage.scaleMode = "noScale"; var bitmap:Bitmap = new Img(); var materialsList:MaterialsList = new MaterialsList(); materialsList.addMaterial(new BitmapMaterial(bitmap.bitmapData, false), 'all'); _forme3D = new Cube(materialsList, 500, 500, 500, 10, 10, 10); scene.addChild(_forme3D); startRendering(); } override protected function onRenderTick(e:Event=null):void { _forme3D.localRotationY +=1; super.onRenderTick(); } } }
merci pour ta réponse !
j'ai cependant une colle pour toi si je veux habiller mon cube avec 4 face au motif différent je procède comment ?
car la balise embed est unique non ?
embed n'est pas lié a papervision mais a flash !
elle permet d'importer des fichiers externes (pratique dans FlashDevelop) et non, tu peux importer autant de fichiers que tu veux (image/audio/sprite) grace a cette balise.
c'est bon, j'ai trouvé ton erreur, c'est tout simplement le nombre de poly par face, tu es au mini ce qui donne ce résultat médiocre !
remplace ta ligne de définition du cube par ca :
augmente le nombre de segments si tu as encore des artefacts
Code : Sélectionner tout - Visualiser dans une fenêtre à part cube = new Cube(materialList, 320, 320, 320, 5, 5, 5);
Partager