1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
define.class(function(require, $ui$, view){
define.class(this, 'shape3d', this.Shader, function(){
this.draworder = 0
this.depth_test = 'src_depth < dst_depth'
this.vertexstruct = define.struct({
pos: vec3,
norm: vec3,
uv: vec2,
data: vec4
})
this.diffusecolor = vec4("#ffffff")
this.mesh = this.vertexstruct.array()
this.position = function() {
var temp = (vec4(mesh.norm,1.0) * view.normalmatrix)
transnorm = temp.xyz
pos = vec4(mesh.pos, 1) * view.totalmatrix * view.viewmatrix
return pos
}
this.color = function() {
var tn = normalize(transnorm.xyz)
return vec4(tn * 0.5 + 0.5, 1.0)
}
})
this.shape3d = true
this.hardrect = false
})
|