[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende... |
Date: |
Mon, 16 Sep 2002 10:39:27 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/16 10:39:27
Modified files:
gfx/demo : irregular2.py
gfx/librenderables: renderables.py
Log message:
Draw inside of IrregularQuad, make movable
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.1 gzz/gfx/demo/irregular2.py:1.2
*** gzz/gfx/demo/irregular2.py:1.1 Mon Sep 16 09:59:42 2002
--- gzz/gfx/demo/irregular2.py Mon Sep 16 10:39:27 2002
***************
*** 8,23 ****
class IrreguScene:
def __init__(self):
print "Texture id:", tex.getTexId()
! self.iq = GZZGL.createIrregularQuad(tex.getTexId(), -1, -1, 1, 1, 1.2)
! def key(self, key):
pass
def scene(self, vs):
putnoc(vs, background((0.1,0.4,0.5)))
! cs1 = vs.coords.affineCoordsys(0, "1", 10, 600, 450, 100, 0, 0, 100)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450, 200, 0, 0, 200)
vs.map.put(self.iq, cs1, cs2)
currentScene = IrreguScene()
--- 8,48 ----
class IrreguScene:
def __init__(self):
print "Texture id:", tex.getTexId()
! self.iq = GZZGL.createIrregularQuad(-1, -1, 1, 1, 1.2, """
! PushAttrib ENABLE_BIT
! Enable ALPHA_TEST
! AlphaFunc GREATER 0.2
! BindTexture TEXTURE_2D %s
! Enable TEXTURE_2D
! Enable REGISTER_COMBINERS_NV
! CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
! CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV ZERO
UNSIGNED_INVERT_NV ALPHA
! CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0
SIGNED_NEGATE_NV ALPHA
! CombinerInputNV COMBINER0_NV ALPHA VARIABLE_C_NV ZERO
UNSIGNED_INVERT_NV ALPHA
! CombinerInputNV COMBINER0_NV ALPHA VARIABLE_D_NV
SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE
! CombinerOutputNV COMBINER0_NV ALPHA DISCARD_NV DISCARD_NV
SPARE0_NV NONE NONE FALSE FALSE FALSE
! FinalCombinerInputNV VARIABLE_A_NV ZERO UNSIGNED_IDENTITY_NV
RGB
! FinalCombinerInputNV VARIABLE_B_NV ZERO UNSIGNED_IDENTITY_NV
RGB
! FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV
RGB
! FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV
UNSIGNED_IDENTITY_NV RGB
! FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV
UNSIGNED_IDENTITY_NV ALPHA
! """ % tex.getTexId())
! self.x1, self.y1 = 600, 450
!
! def key(self, k):
! if 0: pass
! elif k == "Up": self.y1 -= 50
! elif k == "Down": self.y1 += 50
! elif k == "Left": self.x1 -= 50
! elif k == "Right": self.x1 += 50
pass
def scene(self, vs):
putnoc(vs, background((0.1,0.4,0.5)))
! cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x1, self.y1, 100, 0,
0, 100)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450, 100, 0, 0, 100)
vs.map.put(self.iq, cs1, cs2)
currentScene = IrreguScene()
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.32
gzz/gfx/librenderables/renderables.py:1.33
*** gzz/gfx/librenderables/renderables.py:1.32 Mon Sep 16 10:18:01 2002
--- gzz/gfx/librenderables/renderables.py Mon Sep 16 10:39:27 2002
***************
*** 677,693 ****
{
"Type" : "2",
"Name": "IrregularQuad",
! "Data": "float x0, y0, x1, y1, border; int texid;",
"Params" : """
! int texid, float x0, float y0, float x1, float y1, float border
""",
"ParamCode" : """
- this->texid = texid;
this->x0 = x0;
this->y0 = y0;
this->x1 = x1;
this->y1 = y1;
this->border = border;
""",
"ExtraClass" : """
template <class Coords>
--- 677,693 ----
{
"Type" : "2",
"Name": "IrregularQuad",
! "Data": "float x0, y0, x1, y1, border; CallGLCode setup;",
"Params" : """
! float x0, float y0, float x1, float y1, float border, String
setupcode
""",
"ParamCode" : """
this->x0 = x0;
this->y0 = y0;
this->x1 = x1;
this->y1 = y1;
this->border = border;
+ setup = CallGLCode(string(setupcode.begin(),
setupcode.end()).c_str());
""",
"ExtraClass" : """
template <class Coords>
***************
*** 711,738 ****
"RenderCode" : """
DBG(dbg) << "Irregular quad\\n";
- glPushAttrib(GL_ENABLE_BIT);
- glEnable(GL_ALPHA_TEST);
- glAlphaFunc(GL_GREATER, 0.2);
- GLERR;
-
- static CallGLCode setup;
- if (setup.getListName() == 0)
- setup = CallGLCode(
- "Enable REGISTER_COMBINERS_NV\\n"
- "CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1\\n"
- "CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV ZERO
UNSIGNED_INVERT_NV ALPHA\\n"
- "CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0
SIGNED_NEGATE_NV ALPHA\\n"
- "CombinerInputNV COMBINER0_NV ALPHA VARIABLE_C_NV ZERO
UNSIGNED_INVERT_NV ALPHA\\n"
- "CombinerInputNV COMBINER0_NV ALPHA VARIABLE_D_NV
SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE\\n"
- "CombinerOutputNV COMBINER0_NV ALPHA DISCARD_NV DISCARD_NV
SPARE0_NV NONE NONE FALSE FALSE FALSE\\n"
- "FinalCombinerInputNV VARIABLE_A_NV ZERO UNSIGNED_IDENTITY_NV
RGB\\n"
- "FinalCombinerInputNV VARIABLE_B_NV ZERO UNSIGNED_IDENTITY_NV
RGB\\n"
- "FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV
RGB\\n"
- "FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV
UNSIGNED_IDENTITY_NV RGB\\n"
- "FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV
UNSIGNED_IDENTITY_NV ALPHA\\n"
- );
-
setup();
GLERR;
--- 711,716 ----
***************
*** 750,759 ****
{ Pt(x0,y0), Pt(x0, y1), Pt(x0b, y1b), Pt(x0b,
y0b) },
{ Pt(x1,y0), Pt(x1, y1), Pt(x1b, y1b), Pt(x1b,
y0b) } };
- glBindTexture(GL_TEXTURE_2D, texid);
- glEnable(GL_TEXTURE_2D);
- //glDisable(GL_REGISTER_COMBINERS_NV);
-
glBegin(GL_QUADS);
for (int i = 0; i < 4; i++) {
Pt tex0 = invtransform(coords2, coords1.transform(sides[i][0]));
--- 728,733 ----
***************
*** 785,792 ****
glEnd();
GLERR;
! glPopAttrib();
GLERR;
""",
} ,
--- 759,775 ----
glEnd();
GLERR;
! glDisable(GL_REGISTER_COMBINERS_NV);
! glDisable(GL_TEXTURE_2D);
! glBegin(GL_QUADS);
! coords1.vertex(Pt(x0,y0));
! coords1.vertex(Pt(x1,y0));
! coords1.vertex(Pt(x1,y1));
! coords1.vertex(Pt(x0,y1));
! glEnd();
GLERR;
+
+ glPopAttrib();
""",
} ,
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/16
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/Rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/18
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/18
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/26
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/26
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/28