3 Replies Latest reply: Oct 10, 2011 3:49 AM by mvid RSS

    setting texture for materials seems to be broken/have never worked with PRC files

    A. Grahn Community Member

      I am trying to programmatically set the  emissiveTexture.image property of materials to an embedded image resource. However this doesn't have any effect for PRC objects, but works with U3D objects. This is the JavaScript I am using:

       

      var img=new Image(new Resource("pdf://sunset.jpg"));

      for(i=0;i<scene.materials.count;i++){

        var mat=scene.materials.getByIndex(i);

        host.console.println(mat.name);

        mat.emissiveTexture.image=img;

        mat.emissiveTexture.amount=1.0;

      }

       

      Note that scene.materials.count is .gt. 0 for my PRC data.

       

      Thanks!