DirectionalLight.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:fabulae 作者:
/** Directional lights simulate light source that locations is at infinite distance. Direction and intensity is same everywhere.
 * -90 direction is straight from up.
 * 
 * @param rayHandler
 * @param rays
 * @param color
 * @param directionDegree */
public DirectionalLight (RayHandler rayHandler, int rays, Color color, float directionDegree) {

    super(rayHandler, rays, color, directionDegree, Float.POSITIVE_INFINITY);

    vertexNum = (vertexNum - 1) * 2;

    start = new Vector2[rayNum];
    end = new Vector2[rayNum];
    for (int i = 0; i < rayNum; i++) {
        start[i] = new Vector2();
        end[i] = new Vector2();
    }
    setDirection(direction);

    lightMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
        "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
        new VertexAttribute(Usage.Generic, 1, "s"));
    softShadowMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
        "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
        new VertexAttribute(Usage.Generic, 1, "s"));
    update();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号