1 | #require <gl/gl.sbp>
|
---|
2 | Namespace ActiveBasic
|
---|
3 | Namespace OpenGL
|
---|
4 |
|
---|
5 | '光源を扱うためのクラス
|
---|
6 | Class Light
|
---|
7 | Public
|
---|
8 | Sub Light(num As DWord)
|
---|
9 | number = num
|
---|
10 | End Sub
|
---|
11 |
|
---|
12 | Public
|
---|
13 | Sub Ambient(red As Single, green As Single, blue As Single, alpha As Single)
|
---|
14 | Dim color[3] As Single
|
---|
15 | color[0]=red
|
---|
16 | color[1]=green
|
---|
17 | color[2]=blue
|
---|
18 | color[3]=alpha
|
---|
19 | glLightfv(GL_LIGHT0+number,GL_AMBIENT,color)
|
---|
20 | End Sub
|
---|
21 | Sub ConstantAttenuation(rate As Single)
|
---|
22 | glLightf(GL_LIGHT0+number,GL_CONSTANT_ATTENUATION,rate)
|
---|
23 | End Sub
|
---|
24 | Sub SpotCutOff(angle As Single)
|
---|
25 | glLightf(GL_LIGHT0+number,GL_SPOT_CUTOFF,angle)
|
---|
26 | End Sub
|
---|
27 | Sub Diffuse(red As Single, green As Single, blue As Single, alpha As Single)
|
---|
28 | Dim color[3] As Single
|
---|
29 | color[0]=red
|
---|
30 | color[1]=green
|
---|
31 | color[2]=blue
|
---|
32 | color[3]=alpha
|
---|
33 | glLightfv(GL_LIGHT0+number,GL_DIFFUSE,color)
|
---|
34 | End Sub
|
---|
35 | Sub SpotDirection(x As Single, y As Single, z As Single)
|
---|
36 | Dim dir[2] As Single
|
---|
37 | dir[0]=x
|
---|
38 | dir[1]=y
|
---|
39 | dir[2]=z
|
---|
40 | glLightfv(GL_LIGHT0+number,GL_SPOT_DIRECTION,dir)
|
---|
41 | End Sub
|
---|
42 | Sub SpotExponent(exp As Single)
|
---|
43 | glLightf(GL_LIGHT0+number,GL_SPOT_EXPONENT,exp)
|
---|
44 | End Sub
|
---|
45 | Sub LinearAttenuation(rate As Single)
|
---|
46 | glLightf(GL_LIGHT0+number,GL_LINEAR_ATTENUATION,rate)
|
---|
47 | End Sub
|
---|
48 | Sub QuadraticAttenuation(rate As Single)
|
---|
49 | glLightf(GL_LIGHT0+number,GL_QUADRATIC_ATTENUATION,rate)
|
---|
50 | End Sub
|
---|
51 | Sub Specular(red As Single, green As Single, blue As Single, alpha As Single)
|
---|
52 | Dim color[3] As Single
|
---|
53 | color[0]=red
|
---|
54 | color[1]=green
|
---|
55 | color[2]=blue
|
---|
56 | color[3]=alpha
|
---|
57 | glLightfv(GL_LIGHT0+number,GL_SPECULAR,color)
|
---|
58 | End Sub
|
---|
59 |
|
---|
60 | Private
|
---|
61 | number As DWord
|
---|
62 | End Class
|
---|
63 |
|
---|
64 | End Namespace
|
---|
65 | End Namespace
|
---|