Hello,
I've managed to add a texture to a model from 3D default script. Now I would like to do the same from the document level script when the pdf document is opened.
Here's the snippet I've tried:
var open;
function start()
{
if (open != "open")
{
c3d = this.getAnnots3D(0)[0].context3D;
var modelResource = new Resource( "pdf://sphere.u3d" );
var model = c3d.scene.addModel( modelResource );
model = c3d.scene.meshes.getByName("Sphere");
imageResource = new Resource( "pdf://grid.jpg" );
image = new Image( imageResource );
model.material.diffuseTexture.setImage( image );
bump = new Image( new Resource( "pdf://knurl.jpg" ) );
model.material.bumpTexture.setImage( bump );
open = "open";
}
}
However, all I receive are "Resource is not defined" error messages. All the files are defined in the resources of 3D box. What am I doing wrong? All the help is highly appreciated.