Ignore:
Timestamp:
2015-02-09T09:51:09+13:00 (9 years ago)
Author:
bmt11
Message:

Added Tooltip for slider need to rework so that it doesnt overlay

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/render-3d/flag.html

    r29696 r29719  
    180180        <script type="text/javascript">
    181181            var keyboard = new KeyboardState();
    182             var clothTextures = [];
     182            var clothTexture;
    183183
    184184            var initial = true;
     
    227227            // array for holding existing flags
    228228           
    229             var flags = ["./images/flag.png", "./images/flag2.png", "./images/canada.png"];
     229            var flag = "./images/flag.png";//, "./images/flag2.png", "./images/canada.png"];
    230230            var flagSelector = 0;
    231231            var materials;
     
    305305                var session_id = $.cookie('JSESSIONID');
    306306                if (session_id) {
    307                   flags[0] = "images/flag-" + session_id + ".png";
     307                  flag = "images/flag-" + session_id + ".png";
    308308                }
    309309
    310310                // load flag textures
    311                 var i;
    312                
    313                 for(i = 0; i < flags.length; i++){
    314                     clothTextures[i] = THREE.ImageUtils.loadTexture( flags[i] );
    315                     //clothTextures[i].needsUpdate = true;
    316                     clothTextures[i].wrapS = clothTextures[i].wrapT = THREE.ClampToEdgeWrapping;
    317                     clothTextures[i].anisotropy = 16;
    318                 }
     311               
     312                clothTexture = THREE.ImageUtils.loadTexture( flag );
     313                clothTexture.wrapS = clothTexture.wrapT = THREE.ClampToEdgeWrapping;
     314                clothTexture.anisotropy = 16;
    319315                createFlag();
    320316               
     
    418414            function createFlag(flagFilename) {
    419415                    if (flagFilename) {
    420                     flags[0] = "./images/" + flagFilename;
     416                    flag = "./images/" + flagFilename;
    421417                }
    422418   
     
    425421                    // create materials
    426422                    materials = [
    427                         new THREE.MeshLambertMaterial( {specular: 0x030303, fog: false, emissive: 0x111111, shininess: 10, map: clothTextures[0], side: THREE.DoubleSide } ),
     423                        new THREE.MeshLambertMaterial( {specular: 0x030303, fog: false, emissive: 0x111111, shininess: 10, map: clothTexture, side: THREE.DoubleSide } ),
    428424                    ];
    429425                   
     
    434430                    clothGeometry.computeFaceNormals();
    435431
    436                     uniforms = { texture:  { type: "t", value: 0, texture: clothTextures[0] } };
     432                    uniforms = { texture:  { type: "t", value: 0, texture: clothTexture } };
    437433                    vertexShader = document.getElementById( 'vertexShaderDepth' ).textContent;
    438434                    fragmentShader = document.getElementById( 'fragmentShaderDepth' ).textContent; 
     
    454450               
    455451                }else{
    456                     clothTextures[flagSelector] = THREE.ImageUtils.loadTexture( flags[flagSelector]+'?'+Date.now() );
    457                     object.material.map = clothTextures[flagSelector];
     452                    clothTexture = THREE.ImageUtils.loadTexture( flag+'?'+Date.now() );
     453                    object.material.map = clothTexture;
    458454                    object.material.needsUpdate = true;
    459455                }
Note: See TracChangeset for help on using the changeset viewer.