[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/vobs/Trivial.hxx vob/demo/vp...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob include/vob/vobs/Trivial.hxx vob/demo/vp... |
Date: |
Fri, 23 May 2003 04:52:34 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/05/23 04:52:34
Modified files:
include/vob/vobs: Trivial.hxx
vob/demo : vpmultifil.py
Log message:
Shape adjusting --- argh
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/vpmultifil.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.18
libvob/include/vob/vobs/Trivial.hxx:1.19
--- libvob/include/vob/vobs/Trivial.hxx:1.18 Wed May 14 18:03:30 2003
+++ libvob/include/vob/vobs/Trivial.hxx Fri May 23 04:52:34 2003
@@ -35,6 +35,8 @@
#include <vob/Vec23.hxx>
#include <vob/VecGL.hxx>
+#include <vob/glerr.hxx>
+
#ifndef VOB_DEFINED
#define VOB_DEFINED(t)
@@ -129,7 +131,9 @@
}
void render() const {
+ GLERR;
glCallList(no.get());
+ GLERR;
}
};
@@ -138,6 +142,7 @@
struct CallListCoorded : public CallList {
enum { NTrans = 1 };
template<class T> void render(const T &t) const {
+ GLERR;
glPushMatrix();
if(t.performGL()) {
glCallList(no.get());
@@ -146,6 +151,7 @@
t.dump(std::cout);
}
glPopMatrix();
+ GLERR;
}
};
VOB_DEFINED(CallListCoorded);
@@ -153,6 +159,7 @@
struct CallListBoxCoorded : public CallList {
enum { NTrans = 1 };
template<class T> void render(const T &t) const {
+ GLERR;
glPushMatrix();
if(t.performGL()) {
Pt boxwh = t.getSqSize();
@@ -164,6 +171,7 @@
t.dump(std::cout);
}
glPopMatrix();
+ GLERR;
}
};
VOB_DEFINED(CallListBoxCoorded);
@@ -181,6 +189,7 @@
f(dicex, dicey, flags);
}
template<class T> void render(const T &t) const {
+ GLERR;
Pt boxwh = t.getSqSize();
if(flags & 1) {
glPushMatrix();
@@ -211,6 +220,7 @@
glEnd();
}
}
+ GLERR;
}
};
VOB_DEFINED(Quad);
Index: libvob/vob/demo/vpmultifil.py
diff -u libvob/vob/demo/vpmultifil.py:1.2 libvob/vob/demo/vpmultifil.py:1.3
--- libvob/vob/demo/vpmultifil.py:1.2 Thu May 22 09:53:31 2003
+++ libvob/vob/demo/vpmultifil.py Fri May 23 04:52:34 2003
@@ -30,23 +30,116 @@
out float4 opos: POSITION,
out float4 col: COLOR
) {
+ float thickness = 5 + 1000 / (dists.y * dists.y);
- float pi = 3.141592;
+ float pi = 3.14159;
- float ang = pos.x / 2.01;
+ float2 targetvector = float2(sin(angles.y), cos(angles.y));
+ float2 dtargetvector = angles.x * r90(targetvector);
- float curang = lerp(angles.y, angles.z, ang);
- float curdist = lerp(dists.y, dists.z, ang);
+ float rangle = angles.y + angles.x * pi / 4;
+ float2 touchvector = float2(sin(rangle), cos(rangle));
+
+ float sinangle = abs(dot(r90(targetvector), touchvector));
+ float cosangle = dot(targetvector, touchvector);
+
+ float2 tangentinters =
+ dists.x * targetvector / cosangle;
+
+
+ float4 p0 = float4(0,0,0,1);
+ p0.xy = targetvector * dists.y +
+ dtargetvector * thickness;
+
+ float4 p2 = float4(0,0,0,1);
+ p2.xy = touchvector * dists.x;
+
+ float4 p1 = float4(0,0,0,1);
+ p1.xy = lerp(p2.xy, tangentinters,
+ 1-(thickness / dists.x) / sinangle);
+
+ // weights - multiply all homog coords
+ p0 *= .1;
+ p1 *= 1;
+ p2 *= 5;
+
+ float4 coeff = float4(
+ pos.x * pos.x,
+ 2 * pos.x * (1-pos.x),
+ (1-pos.x) * (1-pos.x),
+ 0
+ );
+
+ // coeff = float4(.5,.3,.2,0);
+
+ float4 bez = coeff.x * p0 + coeff.y * p1 + coeff.z * p2;
+ bez /= bez.w;
+
+ float2 foopos = lerp(p0.xy, // targetvector * dists.y,
+ p1.xy, // touchvector * dists.x,
+ pos.x) ;
+
+ // bez.xy = lerp(foopos.xy, bez.xy, pos.y);
+
+ float4 rpos4 = float4(0,0,0,1);
+ rpos4.xy = center + bez.xy + 5 * pos.y * float2(1,1);
+
+ opos = mul(glstate.matrix.mvp, rpos4);
+
+ col.xyz = coeff.xyz;
+ col.w = .8;
+}
+
+""", "arbvp1")),
+]
+
+foo = [
+# GL.createProgram(cg.compile("""
+(("""
+
+float2 r90(float2 v) {
+ return float2(v.y, -v.x);
+}
+
+float2 rn90(float2 v) {
+ return float2(-v.y, v.x);
+}
+
+void main(
+ float4 pos: POSITION,
+ uniform float2 center: C0,
+ uniform float3 zooms: C1,
+ uniform float3 zs: C2,
+ uniform float3 angles: C3,
+ uniform float3 dists: C4,
+ uniform float4 params: C5,
+ out float4 opos: POSITION,
+ out float4 col: COLOR
+) {
+ float angle = abs(angles.z - angles.y);
+ float thickness = 5 + 50 / dists.y;
+ float erad = (1 + .5 * (1-smoothstep(0, 1, angle))) * dists.x;
+
+ float xcoord = lerp(.1 / angle, 1, pos.x * pos.x);
+ float ycoord = (1-pos.x)*(1-pos.x);
+
+ float realy = lerp(erad, dists.y, ycoord);
+
+
+ xcoord /= realy / erad;
+
+ float2 targetvector = float2(sin(angles.y), cos(angles.y));
+ float2 dtargetvector = angles.x * r90(targetvector);
+
+
+ float curang = lerp(angles.y, angles.z, xcoord / 2);
float2 v = float2(sin(curang), cos(curang));
float2 dv = angles.x * r90(v);
- float sfact = (1-sqrt(sqrt(1-(1-pos.x)*(1-pos.x)*(1-pos.x)*(1-pos.x))));
-
float2 rpos = center +
- (dists.x + sfact * (curdist-dists.x)) * v +
- (1-pos.x) * (10 - sfact * ang * pi * curdist ) * dv +
+ (realy) * v +
// rand offset
pos.y * 2 * v + pos.y * 2 * dv;
@@ -59,7 +152,8 @@
col.w = .8;
}
-""", "arbvp1"))]
+""", "arbvp1"))
+]
class Scene:
def __init__(self):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/vobs/Trivial.hxx vob/demo/vp...,
Tuomas J. Lukka <=