Changes between Version 35 and Version 36 of PythonOcc/elbow


Ignore:
Timestamp:
Dec 17, 2013, 12:47:59 AM (10 years ago)
Author:
Leon Kos
Comment:

Teksture

Legend:

Unmodified
Added
Removed
Modified
  • PythonOcc/elbow

    v35 v36  
    560560        copy_mesh(meshes[i], theScene, 0, 0, -90, 0, 500, 0);
    561561}}}
     562
     563
     564== Teksture ==
     565Naredimo podlago za naš model tako, da mrežo naredimo kar v JSC3D in nanjo prilepimo teksturo.
     566Namesto trikotnikov bomo podali kar štirikotnik. Teksturo trave pripnemo na stran.
     567{{{
     568#!javascript
     569viewer.setParameter('RenderMode', 'texture');
     570///...
     571  pod = new JSC3D.Mesh();
     572  pod.isDoubleSided = false; w = 1000; h = -50;
     573  pod.vertexBuffer = [-w, -w, h, w, -w, h, w, w, h, -w, w, h];
     574  pod.indexBuffer = [0, 1, 2, 3, -1];
     575  pod.texCoordBuffer = [0, 0, 1, 0, 1, 1,  0, 1];
     576  pod.texCoordIndexBuffer = [0,1,2,3,-1];
     577  pod.init();
     578  var tex = new JSC3D.Texture;
     579  tex.onready = function() {
     580      pod.setTexture(this);
     581      viewer.update();
     582  };
     583 tex.createFromUrl('/vaje/raw-attachment/wiki/PythonOcc/elbow/Grass_by_jaqx_textures.jpg');                                 
     584 theScene.addChild(pod);
     585 viewer.update();
     586}}}