예제 #1
0
def getpaper(vecs, cols, x0, y0, x1, y1, t0, t1, tex0comb, isectcomb,
             tex1comb):
    pap = Paper()
    pap.setNPasses(1)
    ppass = pap.getPass(0)
    ppass.setSetupcode("""
    	    PushAttrib ENABLE_BIT TEXTURE_BIT DEPTH_BUFFER_BIT
    """)
    ppass.setTeardowncode("""
	    PopAttrib
            ActiveTexture TEXTURE0
    """)

    # texid = vob.paper.textures.ptextures["RGB2"][1].getTexId();
    texid0 = vob.paper.textures.getNamed("RGB2", t0).getTexId()
    texid1 = vob.paper.textures.getNamed("RGB2", t1).getTexId()

    constcode = """
        ActiveTexture TEXTURE0
        Enable TEXTURE_2D
        BindTexture TEXTURE_2D %(texid0)s
        TexParameter TEXTURE_2D TEXTURE_WRAP_S REPEAT
        TexParameter TEXTURE_2D TEXTURE_WRAP_T REPEAT
        TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
        TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
        
        ActiveTexture TEXTURE1
        Enable TEXTURE_2D
        BindTexture TEXTURE_2D %(texid1)s
        TexParameter TEXTURE_2D TEXTURE_WRAP_S REPEAT
        TexParameter TEXTURE_2D TEXTURE_WRAP_T REPEAT
        TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
        TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
        
        Enable BLEND
        BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA 
        BlendEquation FUNC_ADD
        Disable ALPHA_TEST

        Enable REGISTER_COMBINERS_NV
    """ % locals()

    r0, r1 = vecs
    c0, c1, c2, c3 = cols
    constcode += """
        Color %(c0)s
        SecondaryColorEXT %(c1)s
        Fog FOG_COLOR %(c2)s
        CombinerParameterNV CONSTANT_COLOR0_NV %(r0)s
        CombinerParameterNV CONSTANT_COLOR1_NV %(r1)s
    """ % locals()

    return GLRen.createBasisPaperQuad(
        pap, 0, 0, x0, y0, 0, 0, x1, y1,
        GL.createDisplayList(constcode + parsedTexcodes[tex0comb]),
        GL.createDisplayList(constcode + parsedTexcodes[tex1comb]),
        GL.createDisplayList(constcode + parsedTexcodes[isectcomb]))
예제 #2
0
    def compile(self, *args):
        if self.list:
            self.list = None
            return

        list = GL.createDisplayList()
        vs = w.createVobScene()
        self.putGraph(vs, 0, 800)

        list.startCompile(w.window)

        #w.renderStill(vs, 0)
        vs.coords.renderInterp(w.getRenderingSurface(), vs.map, None, None, 0,
                               0, 1)

        list.endCompile(w.window)

        self.list = GLRen.createCallListCoorded(list)