Skip to content
Snippets Groups Projects
Select Git revision
  • f73150d074fa7a887307f0454e2f5d7ad1e631e2
  • master default protected
  • rednatco-v2
  • base-pairs-ladder
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

polymer-trace-mesh.ts

Blame
  • texture3d-from-2d-linear.glsl NaN GiB
    /**
     * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     * @author Michael Krone <michael.krone@uni-tuebingen.de>
     */
    
    #pragma glslify: myMod = require(./my-mod.glsl)
    #pragma glslify: myDiv = require(./my-div.glsl)
    
    vec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {
        float zSlice0 = floor(pos.z * gridDim.z);
        float column0 = myMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;
        float row0 = floor(myDiv(zSlice0 * gridDim.x, texDim.x));
        vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;
        vec4 color0 = texture2D(tex, coord0);
    
        float zSlice1 = zSlice0 + 1.0;
        float column1 = myMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;
        float row1 = floor(myDiv(zSlice1 * gridDim.x, texDim.x));
        vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;
        vec4 color1 = texture2D(tex, coord1);
    
        float delta0 = abs((pos.z * gridDim.z) - zSlice0);
        return mix(color0, color1, delta0);
    }
    
    #pragma glslify: export(texture3dFrom2dLinear)