⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 light.java

📁 一个J2ME的3D 一个J2ME的3D 一个J2ME的3D
💻 JAVA
字号:
/**
 * 
 */
package object3d;

import Math.FIX16;
import Math.MathTool;
import Math.Point4D;
import Math.Vector4D;

/**
 * @author PanXu
 *
 */
public class Light {

	/**
	 * 常量
	 */
	public static int LIGHT_STATE_AMBIENT 		= 0x0001 ;//环境光
	public static int LIGHT_STATE_POINT   		= 0x0002 ;//点光源
	public static int LIGHT_STATE_INFINITY		= 0x0004 ;//无穷远光源
	public static int LIGHT_STATE_SPOTLIGHT 		= 0x0008 ;//聚光灯
	
	/**
	 * 成员变量
	 */
	//状态
	int State ;
	//光源位置
	Point4D Pos = null;
	//光源方向
	Vector4D Dir = null;
	//本影角度
	int LightAng ;
	//半影角度
	int LightHalfAng ;
	//衰减系数
	FIX16 kc , kl , kq ;
	//光照强度
	int a_r , a_g , a_b;
	int p_r , p_g , p_b;
	int s_r , s_g , s_b;
	
	public Light() {
		super();
		// TODO 自动生成构造函数存根
	}
	/**
	 * 初始化光源
	 * @param pos
	 * @param dir
	 * @param state
	 * @param lightang 本(半)影角度
	 * @param lighthalfang
	 * @param kc 衰减因子
	 * @param kl
	 * @param kq
	 * @param ac 光照强度
	 * @param ap
	 * @param as
	 */
	public void InitLight(Point4D pos , Vector4D dir , int state ,int lightang 
			,int lighthalfang , FIX16 kc , FIX16 kl, FIX16 kq 
			,int ac , int pc , int sc) {
		this .Pos = pos ;
		this .Dir = dir ;
		this .State = state ;
		this .LightAng = lightang;
		this .LightHalfAng = lighthalfang ;
		
		this .kc = kc ;
		this .kl = kl ;
		this .kq = kq ;
		
		this .a_b = ac & MathTool.B_MASK;
		this .a_g = (ac & MathTool.G_MASK) >> 8;
		this .a_r = (ac & MathTool.R_MASK) >> 16;
		
		this .p_b = pc & MathTool.B_MASK;
		this .p_g = (pc & MathTool.G_MASK) >> 8;
		this .p_r = (pc & MathTool.R_MASK) >> 16;
		
		this .s_b = sc & MathTool.B_MASK;
		this .s_g = (sc & MathTool.G_MASK) >> 8;
		this .s_r = (sc & MathTool.R_MASK) >> 16;
	}
	
	/**
	 * 执行光照计算
	 * @param rl 渲染列表
	 */
	public void LightPoly (RenderList rl)
	{
		for (int i = 0 ; i < rl .PolyCount ;  i ++)
		{
		}//for 
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -