Пример #1
0
def calcplane(v1,v2,v3,tex):
    r1 = v2 - v1
    r2 = v3 - v1
    norm = r1.cross(r2)
    norm.z = 0
    slope = 0
    ang = 0;
    tz = v1.z
    if abs(norm) != 0:
        dir = norm.normal()
        d1 = r1 * dir
        d2 = r2 * dir
        if abs(d2) > abs(d1):
            slope = r2.z / d2
        else:
            slope = r1.z / d1

        tz = v1.z + (dir.x*(cx - v1.x) + dir.y*(cy - v1.y)) * slope

        ang = atan2(dir.y,dir.x)*180/pi
    return plane(cx,cy,tz,ang,slope,tex,0,0,'')
Пример #2
0
    dist=0 #sqrt(x*x+y*y)/4
    
    return yscale+ang*yscale/pi+dist

for i,s in enumerate(hmap.sectors):
    for ph,bn in enumerate(s.bridges):
        tw = []
        for i in xrange(3):
            cw = hmap.walls[s.wallptr+i]
            tx = cw.x/16.0
            ty = cw.y/-16.0
            tz = zfunc(tx-cx,ty-cy,s.cpx-cx,s.cpy-cy,ph)+cz
            tw.append(v(tx,ty,tz))
        planes.append((i,bn)+tuple(tw))

zeroplane=plane(0,0,0,0,0,0,0,0,'')
bridges=[(zeroplane,zeroplane)]*cbr

for i,b,v1,v2,v3 in planes:
    pl = calcplane(v1,v2,v3,0)
    pl2 = pl.copy()
    pl2.z -= 16
    pl.tex = 81
    pl2.tex = 20
    bridges[b] = (pl,pl2)
print 'from genmap import plane, bridge'
print 'phases=%d'%phases
print 'tbr = ['
for top,bot in bridges:
    print '    bridge(%r,'%top
    print '           %r),'%bot