#require <gl/gl.sbp>
Namespace ActiveBasic
Namespace OpenGL

	'光源を扱うためのクラス
	Class Light
	Public
		Sub Light(num As DWord)
			number = num
		End Sub

	Public
		Sub Ambient(red As Single, green As Single, blue As Single, alpha As Single)
			Dim color[3] As Single
			color[0]=red
			color[1]=green
			color[2]=blue
			color[3]=alpha
			glLightfv(GL_LIGHT0+number,GL_AMBIENT,color)
		End Sub
		Sub ConstantAttenuation(rate As Single)
			glLightf(GL_LIGHT0+number,GL_CONSTANT_ATTENUATION,rate)
		End Sub
		Sub SpotCutOff(angle As Single)
			glLightf(GL_LIGHT0+number,GL_SPOT_CUTOFF,angle)
		End Sub
		Sub Diffuse(red As Single, green As Single, blue As Single, alpha As Single)
			Dim color[3] As Single
			color[0]=red
			color[1]=green
			color[2]=blue
			color[3]=alpha
			glLightfv(GL_LIGHT0+number,GL_DIFFUSE,color)
		End Sub
		Sub SpotDirection(x As Single, y As Single, z As Single)
			Dim dir[2] As Single
			dir[0]=x
			dir[1]=y
			dir[2]=z
			glLightfv(GL_LIGHT0+number,GL_SPOT_DIRECTION,dir)
		End Sub
		Sub SpotExponent(exp As Single)
			glLightf(GL_LIGHT0+number,GL_SPOT_EXPONENT,exp)
		End Sub
		Sub LinearAttenuation(rate As Single)
			glLightf(GL_LIGHT0+number,GL_LINEAR_ATTENUATION,rate)
		End Sub
		Sub QuadraticAttenuation(rate As Single)
			glLightf(GL_LIGHT0+number,GL_QUADRATIC_ATTENUATION,rate)
		End Sub
		Sub Specular(red As Single, green As Single, blue As Single, alpha As Single)
			Dim color[3] As Single
			color[0]=red
			color[1]=green
			color[2]=blue
			color[3]=alpha
			glLightfv(GL_LIGHT0+number,GL_SPECULAR,color)
		End Sub
		
	Private
		number As DWord
	End Class

End Namespace
End Namespace
