[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul... |
Date: |
Fri, 27 Jun 2003 06:11:48 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/06/27 06:11:48
Modified files:
include/vob/vobs: Fillet.hxx
vob/demo/multifil: randgraph.py
vob/fillet : light3d.py
Log message:
texture
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Fillet.hxx.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/randgraph.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/fillet/light3d.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: libvob/include/vob/vobs/Fillet.hxx
diff -u libvob/include/vob/vobs/Fillet.hxx:1.29
libvob/include/vob/vobs/Fillet.hxx:1.30
--- libvob/include/vob/vobs/Fillet.hxx:1.29 Fri Jun 27 03:55:56 2003
+++ libvob/include/vob/vobs/Fillet.hxx Fri Jun 27 06:11:48 2003
@@ -564,13 +564,17 @@
vector<Vec> n(v.size());
- n[0] = (v[1] - v[0]).cw90().normalized();
- for (i = 1; i < v.size() - 1; i++)
- n[i] = (v[i+1] - v[i-1]).cw90().normalized();
- n[v.size() - 1] = (v[v.size()-1] - v[v.size()-2]).cw90().normalized();
+ {
+ size_t i;
+ n[0] = (v[1] - v[0]).cw90().normalized();
+ for (i = 1; i < v.size() - 1; i++)
+ n[i] = (v[i+1] - v[i-1]).cw90().normalized();
+ n[v.size() - 1] = (v[v.size()-1] -
v[v.size()-2]).cw90().normalized();
+ }
+ ZVec ref = t0.transform(ZVec(0,0,1)) - t0.transform(ZVec(0,0,0));
ZVec e0 = (p1 - p0).normalized();
- ZVec e1 = e0.crossp(ZVec(0,0,1)).normalized();
+ ZVec e1 = e0.crossp(ref).normalized();
ZVec e2 = e0.crossp(e1);
float mat[16] = {
@@ -586,16 +590,22 @@
}
void render(const vector<Vec> &v, const vector<Vec> &n) const {
- int i, j;
+ size_t i;
+ int j;
if (v.size() < 2) return;
for (i = 0; i < v.size() - 1; i++) {
glBegin(GL_QUAD_STRIP);
+ float s0 = (float)i / (v.size() - 1);
+ float s1 = (float)(i + 1) / (v.size() - 1);
for (j = 0; j <= ndice; j++) {
float a = 2 * M_PI * j / ndice;
+ float t = (float)j / ndice;
+
+ glTexCoord2f(s0, t);
glNormal3f(n[i].x,
cos(a) * n[i].y,
sin(a) * n[i].y);
@@ -603,6 +613,7 @@
cos(a) * v[i].y,
sin(a) * v[i].y);
+ glTexCoord2f(s1, t);
glNormal3f(n[i + 1].x,
cos(a) * n[i + 1].y,
sin(a) * n[i + 1].y);
Index: libvob/vob/demo/multifil/randgraph.py
diff -u libvob/vob/demo/multifil/randgraph.py:1.17
libvob/vob/demo/multifil/randgraph.py:1.18
--- libvob/vob/demo/multifil/randgraph.py:1.17 Thu Jun 26 09:14:10 2003
+++ libvob/vob/demo/multifil/randgraph.py Fri Jun 27 06:11:48 2003
@@ -33,6 +33,11 @@
from random import Random
+noise = getCachedTexture(
+ [1024, 512, 0, 4, "RGBA", "RGBA", "noise",
+ [ "freq", "100", "bias", ".5", "scale", ".8" ]]
+ )
+
class Scene:
"Random graph"
def __init__(self):
@@ -59,6 +64,7 @@
Toggle("fillet3d", 0, "3D fillets", "3"),
SlideLin("linewidth", 2, 1, "line width", "B", "b"),
Toggle("perspective", 0, "perspective", "F"),
+ Toggle("texture", 0, "texture", "x"),
)
def scene(self, vs):
vs.put( background((.5,1,.2)))
@@ -157,6 +163,16 @@
PushMatrix
""" % light3d.vp[0].getProgId()))
+ if self.texture:
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_2D %s
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20
+ TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE
+ Enable TEXTURE_2D
+ """ % noise.getTexId()))
+
if self.perspective:
vs.put(getDListNocoords("""
MatrixMode PROJECTION
@@ -193,6 +209,7 @@
vs.put(getDListNocoords("""
BindProgram VERTEX_PROGRAM_ARB 0
+ BindTexture TEXTURE_2D 0
PopAttrib
"""))
Index: libvob/vob/fillet/light3d.py
diff -u libvob/vob/fillet/light3d.py:1.4 libvob/vob/fillet/light3d.py:1.5
--- libvob/vob/fillet/light3d.py:1.4 Fri Jun 27 06:08:43 2003
+++ libvob/vob/fillet/light3d.py Fri Jun 27 06:11:48 2003
@@ -7,8 +7,10 @@
void main(
float4 pos: POSITION,
float3 norm: NORMAL,
+ float4 tex0: TEXCOORD0,
out float4 opos: POSITION,
- out float4 col: COLOR
+ out float4 col: COLOR,
+ out float4 otex0: TEXCOORD0
) {
opos = mul(glstate.matrix.mvp, pos);
float4x4 foo = glstate.matrix.modelview[0];
@@ -39,6 +41,8 @@
// float t = 8*mul(glstate.matrix.mvp, pos).z;
// col.rgb = col.rgb * (1 - t) + float3(1,.5,.2) * t;
col.a = 1;
+
+ otex0 = tex0;
}
""", "arbvp1")),
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Tuomas J. Lukka, 2003/06/06
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Janne V. Kujala, 2003/06/25
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Janne V. Kujala, 2003/06/26
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Janne V. Kujala, 2003/06/26
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul...,
Janne V. Kujala <=
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Janne V. Kujala, 2003/06/27
- [Gzz-commits] libvob include/vob/vobs/Fillet.hxx vob/demo/mul..., Janne V. Kujala, 2003/06/27