[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./Makefile gfx/libpaper/texops_STD.py gfx/l...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz ./Makefile gfx/libpaper/texops_STD.py gfx/l... |
Date: |
Fri, 13 Sep 2002 09:40:59 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/13 09:40:59
Modified files:
. : Makefile
gfx/libpaper : texops_STD.py
gfx/librenderables: renderables.py
Added files:
gfx/demo : paperbasis.py
Log message:
Start paper basis texture demo hack; clamping doesn't work as expected
unless the textures have a border
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.164&tr2=1.165&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paperbasis.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texops_STD.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.24&tr2=1.25&r1=text&r2=text
Patches:
Index: gzz/Makefile
diff -c gzz/Makefile:1.164 gzz/Makefile:1.165
*** gzz/Makefile:1.164 Wed Sep 11 11:25:09 2002
--- gzz/Makefile Fri Sep 13 09:40:59 2002
***************
*** 406,411 ****
--- 406,413 ----
$(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/buoydev.py
runfisheye:
$(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/fisheye.py
+ runpaperbasis:
+ $(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/paperbasis.py
runppserver:
$(JYTHON) gzz/modules/pp/ppserver.py
Index: gzz/gfx/libpaper/texops_STD.py
diff -c gzz/gfx/libpaper/texops_STD.py:1.1 gzz/gfx/libpaper/texops_STD.py:1.2
*** gzz/gfx/libpaper/texops_STD.py:1.1 Mon Sep 2 08:56:56 2002
--- gzz/gfx/libpaper/texops_STD.py Fri Sep 13 09:40:59 2002
***************
*** 9,14 ****
--- 9,17 ----
],
];
+ if "basisclamp" not in globals().keys():
+ basisclamp = 0
+
class ShaderPass:
def __init__(self, shaderType):
self.st = shaderType
***************
*** 23,28 ****
--- 26,36 ----
return [i for i in range(0,len(self.st))]
def setupCode(self):
c = ""
+ if basisclamp:
+ print "Clamping texture"
+ wrap = "CLAMP"
+ else:
+ wrap = "REPEAT"
for t in range(0,len(self.st)):
target = self.st[t][0]
texid = self.tex[t]
***************
*** 37,44 ****
Enable %(target)s
BindTexture %(target)s %(texid)s
! TexParameter %(target)s TEXTURE_WRAP_S REPEAT
! TexParameter %(target)s TEXTURE_WRAP_T REPEAT
TexParameter %(target)s TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
TexParameter %(target)s TEXTURE_MAG_FILTER LINEAR
--- 45,52 ----
Enable %(target)s
BindTexture %(target)s %(texid)s
! TexParameter %(target)s TEXTURE_WRAP_S %(wrap)s
! TexParameter %(target)s TEXTURE_WRAP_T %(wrap)s
TexParameter %(target)s TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
TexParameter %(target)s TEXTURE_MAG_FILTER LINEAR
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.24
gzz/gfx/librenderables/renderables.py:1.25
*** gzz/gfx/librenderables/renderables.py:1.24 Thu Sep 12 14:44:11 2002
--- gzz/gfx/librenderables/renderables.py Fri Sep 13 09:40:59 2002
***************
*** 512,517 ****
--- 512,593 ----
} ,
{
+ "Type" : "2",
+ "Name": "BasisPaperQuad",
+ "Data": "Paper::Paper* paper; ",
+ "Params" : """
+ Paper paper
+ """,
+ "ParamCode" : """
+ this->paper = paper;
+ """,
+ "RenderCode" : """
+ DBG(dbg) << "Paper\\n";
+ GLERR
+
+ ZPt c1orig = coords1.transform(Pt(0, 0));
+ ZVec c1x = coords1.transform(Pt(1, 0)) - c1orig;
+ ZVec c1y = coords1.transform(Pt(0, 1)) - c1orig;
+
+ c1x = 1.0 / (c1x.x * c1x.x + c1x.y * c1x.y) * c1x;
+ c1y = 1.0 / (c1y.x * c1y.x + c1y.y * c1y.y) * c1y;
+
+ ZPt c2orig = coords2.transform(Pt(0, 0));
+ ZVec c2x = coords2.transform(Pt(1, 0)) - c2orig;
+ ZVec c2y = coords2.transform(Pt(0, 1)) - c2orig;
+
+ c2x = 1.0 / (c2x.x * c2x.x + c2x.y * c2x.y) * c2x;
+ c2y = 1.0 / (c2y.x * c2y.x + c2y.y * c2y.y) * c2y;
+
+
+ //cout << c1orig << c1x << c1y << "\\n";
+ //cout << c2orig << c2x << c2y << "\\n";
+
+ for(Paper::Paper::iterator it = paper->begin(); it != paper->end();
++it) {
+ if (dbg) cout << "Pass\\n";
+ (*it).setupcode();
+
+ GLERR
+
+ Pt p[] = { Pt(0,0), Pt(0,1), Pt(1,1), Pt(1,0) };
+
+ glBegin(GL_QUADS);
+
+ for (int i = 0; i < 4; i++) {
+ ZPt v = coords1.transform(p[i]);
+ glMultiTexCoord2fARB(0, p[i].x, p[i].y);
+ glMultiTexCoord2fARB(1, c2x.dot(v - c2orig),
+ c2y.dot(v - c2orig));
+ //cout << Pt(c2x.dot(v - c2orig),
+ // c2y.dot(v - c2orig)) << "\\n";
+ coords1.vertex(p[i]);
+ }
+
+ for (int i = 0; i < 4; i++) {
+ ZPt v = coords2.transform(p[i]);
+ glMultiTexCoord2fARB(1, p[i].x, p[i].y);
+ glMultiTexCoord2fARB(0, c1x.dot(v - c1orig),
+ c1y.dot(v - c1orig));
+ //cout << Pt(c1x.dot(v - c1orig),
+ // c1y.dot(v - c1orig)) << "\\n";
+ coords2.vertex(p[i]);
+ }
+
+ glEnd();
+
+
+
+ GLERR
+ (*it).teardowncode();
+ GLERR
+
+ }
+
+ GLERR
+ """,
+ } ,
+
+ {
"Type": "1",
"Name": "HorizText",
"Data": """
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./Makefile gfx/libpaper/texops_STD.py gfx/l...,
Janne V. Kujala <=