RavChainLight.java 文件源码

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

项目:RavTech 作者:
/** Creates chain light from specified vertices
 * 
 * @param rayHandler not {@code null} instance of RayHandler
 * @param rays number of rays - more rays make light to look more realistic but will decrease performance, can't be less than
 *           MIN_RAYS
 * @param color color, set to {@code null} to use the default color
 * @param distance distance of light
 * @param rayDirection direction of rays
 *           <ul>
 *           <li>1 = left</li>
 *           <li>-1 = right</li>
 *           </ul>
 * @param chain float array of (x, y) vertices from which rays will be evenly distributed */
public RavChainLight (RayHandler rayHandler, int rays, Color color, float distance, int rayDirection, float[] chain) {
    super(rayHandler, rays, color, distance, 0f);

    rayStartOffset = ChainLight.defaultRayStartOffset;
    this.rayDirection = rayDirection;
    vertexNum = (vertexNum - 1) * 2;
    endX = new float[rays];
    endY = new float[rays];
    startX = new float[rays];
    startY = new float[rays];
    this.chain = (chain != null) ? new FloatArray(chain) : new FloatArray();

    lightMesh = new Mesh(VertexDataType.VertexArray, false, 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, false, vertexNum * 2, 0,
        new VertexAttribute(Usage.Position, 2, "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
        new VertexAttribute(Usage.Generic, 1, "s"));
    setMesh();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号