export_map.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def poly_to_doom(me, p, radius):
    """
    Convert a face into Doom3 representation (infinite plane defined by its normal
    and distance from origin along that normal).
    """
    # Compute the distance to the mesh from the origin to the plane.
    # Line from origin in the direction of the face normal.
    origin = Vector((0, 0, 0))
    target = Vector(p.normal) * radius
    # Find the target point.
    intersect = mathutils.geometry.intersect_line_plane(origin, target, Vector(p.center), Vector(p.normal))
    # We have to handle cases where intersection with face happens on the "negative" part of the vector!
    length = intersect.length
    nor = p.normal.copy()
    if (nor.dot(intersect.normalized()) > 0):
        length *= -1
    nor.resize_4d()
    nor.w = length
    return nor
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号