You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
; modified version of https://github.com/devkitPro/3ds-examples/blob/ea519187782397c279609da80310e0f8c7e80f09/graphics/gpu/fragment_light/source/vshader.v.pica
2
+
; Example PICA200 vertex shader
3
+
4
+
; Uniforms
5
+
.fvec projection[4], modelView[4]
6
+
7
+
; Constants
8
+
.constf myconst(0.0, 1.0, -1.0, 0.5)
9
+
.alias zeros myconst.xxxx ; Vector full of zeros
10
+
.alias ones myconst.yyyy ; Vector full of ones
11
+
.alias half myconst.wwww
12
+
13
+
; Outputs
14
+
.out outpos position
15
+
.out outtex texcoord0
16
+
.out outclr color
17
+
.out outview view
18
+
.out outnq normalquat
19
+
20
+
; Inputs (defined as aliases for convenience)
21
+
.in inpos
22
+
.in innrm
23
+
.in intex
24
+
25
+
.proc main
26
+
; Force the w component of inpos to be 1.0
27
+
mov r0.xyz, inpos
28
+
mov r0.w, ones
29
+
30
+
; r1 = modelView * inpos
31
+
dp4 r1.x, modelView[0], r0
32
+
dp4 r1.y, modelView[1], r0
33
+
dp4 r1.z, modelView[2], r0
34
+
dp4 r1.w, modelView[3], r0
35
+
36
+
; outview = -r1
37
+
mov outview, -r1
38
+
39
+
; outpos = projection * r1
40
+
dp4 outpos.x, projection[0], r1
41
+
dp4 outpos.y, projection[1], r1
42
+
dp4 outpos.z, projection[2], r1
43
+
dp4 outpos.w, projection[3], r1
44
+
45
+
; outtex = intex
46
+
mov outtex, intex
47
+
48
+
; Transform the normal vector with the modelView matrix
49
+
; TODO: use a separate normal matrix that is the transpose of the inverse of modelView
0 commit comments