Hi Andy thanks for your reply.
I've simplified the code and the model, but still I can't get it to
work.
I have two problems:
- I can't get ShadedMaterials
working with my Collada object.
- replaceMaterialByName is
also not working with the Collada object.
See here:
http://www.danwashere.com/dev/papervision/shadedtextures_and_collada_problem/ShadingTest.html
Click anywhere to make it swap the materials (it also moves the object
left and right so you know your click has worked) - it fails to swap
the materials.
Here's the cut down code:
package {
// imports not included
public class PV3DTest extends MovieClip {
private var mc:MovieClip;
private var basicView:BasicView;
private var light:PointLight3D;
private var testColladaObject:Collada;
private var showingShadedMaterial:Boolean;
private var flatShadeMaterial:FlatShadeMaterial;
private var movieMaterial:MovieMaterial;
private var shadedMaterial:ShadedMaterial;
public function PV3DTest($mc:MovieClip) {
mc = $mc;
// Set up of BasicView and Light not
included
// Note: Texture_extra_1 is a
library clip.
movieMaterial = new MovieMaterial(new Texture_extra_1(),
false, true, false);
shadedMaterial = new ShadedMaterial(movieMaterial, new
FlatShader(light, 0xFFFFFF, 0x555555));
flatShadeMaterial = new FlatShadeMaterial(light, 0x8888ff,
0x111133);
var mat:MaterialsList = new MaterialsList();
// Initially use the
flatShadeMaterial, which works ok.
mat.addMaterial(flatShadeMaterial, "material0");
testColladaObject = new Collada("Simple.dae", mat, 0.00005);
basicView.scene.addChild(testColladaObject);
testColladaObject.x = -100;
showingShadedMaterial = false;
mc.stage.addEventListener(Event.ENTER_FRAME,
handleEnterFrame);
mc.stage.addEventListener(MouseEvent.CLICK,
handleMouseClick);
}
private function handleMouseClick($e:MouseEvent):void {
// Toggle the material on mouse
click.
if (showingShadedMaterial) {
// replaceMaterialByName seems
to do nothing
testColladaObject.replaceMaterialByName(flatShadeMaterial,
"material0");
testColladaObject.x = -100;
showingShadedMaterial = false;
} else {
// I also tested this by
swapping one flatShadeMaterial for
// another of a diff colour, that
didn't work either.
testColladaObject.replaceMaterialByName(shadedMaterial,
"material0");
testColladaObject.x = 100;
showingShadedMaterial = true;
}
}
private function handleEnterFrame($e:Event):void {
// Spin the object by mouse position
basicView.singleRender();
}
}
}
Are these known bugs in revision 918 maybe? I'm not sure where to look
to find that out.
Or is it a problem in my Collada DAE file perhaps?
http://www.danwashere.com/dev/papervision/shadedtextures_and_collada_problem/Simple.dae
Thanks,
Dan
andysk8er wrote:
Hi Dan,
Why don't you try to simplify things in your code first. Simply create a
simple flatshadedmaterial, add it to the materials list and do your
replaceMaterialByName. See if you can get that working. Then, go back and
add in your textures, shaders, etc...
I guess I'm not really sure why you are declaring your materials as Classes.
Why not just create MovieAssetMaterials using the linkage name in the
library? Anyway, if you strip all of that stuff out of your code and simply
use a flatshaded material, you can see if that works. If so, you can begin
adding your materials back in until it breaks.
-Andy
DanSearle wrote:
Hi list,
If I understand SVN right I'm on revision 918.
I'm using the free version of Google SketchUp (v6.4.112) to make DAE
files (using that hack to get the DAE from the KMZ it outputs), but I
can't get the ShadedMaterials to work with it.
Here's a demo I've made:
http://www.danwashere.com/dev/papervision/shadedtextures_and_collada_problem/DanWasHereWorld.html
(Mouse Up/Down to move in and out, Mouse Left/Right to move the light
source)
The paddling pool is meant to be shaded - the cube uses the same shaded
materials as the pool to prove that the materials themselves are ok.
Is it maybe that the DAE created in this way isn't compatible with
ShadedMaterials? Here's a link to the DAE file:
http://www.danwashere.com/dev/papervision/shadedtextures_and_collada_problem/paddling%20pond.dae
Or in case it's a code problem, here's the relevant code, or you can
also get the AS file here:
http://www.danwashere.com/dev/papervision/shadedtextures_and_collada_problem/DanWasHereWorld.as
(Note that I have the textures in the FLA library)
*** I've cut the code from this reply cos it wasn't useful ***
I'd love an explanation of how to do this if someone can help?
Many thanks,
Dan
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.2/2215 - Release Date: 07/02/09 18:06:00
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org