[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/stats/TexAccum.hxx include/v...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob include/vob/stats/TexAccum.hxx include/v... |
Date: |
Wed, 18 Jun 2003 05:44:38 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/06/18 05:44:38
Modified files:
include/vob/stats: TexAccum.hxx
include/vob/vobs: Paper.hxx
org/nongnu/libvob/impl/gl: GLRenderingSurface.java
org/nongnu/libvob/memory: MemoryPartitioner.java
src/jni : GLRen.template.java TexAccum.cxx
src/stats : Stats.cxx TexAccum.cxx
test/vob/gl : texaccum.test
Log message:
Allow texaccum multipliers to fixedpaperquad
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/stats/TexAccum.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Paper.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/memory/MemoryPartitioner.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/GLRen.template.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/TexAccum.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/stats/Stats.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/stats/TexAccum.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/texaccum.test.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: libvob/include/vob/stats/TexAccum.hxx
diff -u libvob/include/vob/stats/TexAccum.hxx:1.1
libvob/include/vob/stats/TexAccum.hxx:1.2
--- libvob/include/vob/stats/TexAccum.hxx:1.1 Mon Jun 16 12:16:29 2003
+++ libvob/include/vob/stats/TexAccum.hxx Wed Jun 18 05:44:38 2003
@@ -56,8 +56,9 @@
* algorithm may be substituted later.
* @param p1,p2,p3 The corners in screen space, in pixel coords
* @param t1,t2,t3 The corners in texture coordinate space.
+ * @param texAreaMult The area in texture space will be multiplied by
this.
*/
- void add(ZPt &p1, ZPt &p2, ZPt &p3, Pt &t1, Pt &t2, Pt &t3);
+ void add(ZPt &p1, ZPt &p2, ZPt &p3, Pt &t1, Pt &t2, Pt &t3, float
texAreaMult);
virtual void clear();
};
}
Index: libvob/include/vob/vobs/Paper.hxx
diff -u libvob/include/vob/vobs/Paper.hxx:1.13
libvob/include/vob/vobs/Paper.hxx:1.14
--- libvob/include/vob/vobs/Paper.hxx:1.13 Mon Jun 16 12:16:30 2003
+++ libvob/include/vob/vobs/Paper.hxx Wed Jun 18 05:44:38 2003
@@ -125,14 +125,15 @@
}
inline void addToAccum(Stats::TexAccum *acc, Verts &v,
- int v0, int v1, int v2) {
+ int v0, int v1, int v2, float texAreaMult) {
acc->add(
v.points[v0].final,
v.points[v1].final,
v.points[v2].final,
v.points[v0].orig,
v.points[v1].orig,
- v.points[v2].orig);
+ v.points[v2].orig,
+ texAreaMult);
}
inline int splitTri(Verts &v, float dicelen1, float dicelen2, int i, int j,
int k) {
@@ -210,6 +211,7 @@
const int PAPERQUAD_USE_VERTEX_PROGRAM = 2;
const int PAPERQUAD_NONL_MAXLEN = 4;
+
/** A paperquad with no separation between paper and object coordinates.
*/
class FixedPaperQuad {
@@ -223,10 +225,11 @@
int diceDepth;
Stats::TexAccum *texAccum;
+ float texAreaMult;
template<class F> void params(F &f) {
f(paper, x0, y0, x1, y1, flags, diceLength, diceLength2, diceDepth,
- texAccum);
+ texAccum, texAreaMult);
}
@@ -256,7 +259,7 @@
diceLength*2, diceLength2*2, _1, _2, _3));
// Then, calculate the texture surface estimates
triangler.iterateTriangles(
- bind(addToAccum, texAccum, ref(verts), _1, _2, _3));
+ bind(addToAccum, texAccum, ref(verts), _1, _2, _3,
texAreaMult));
}
// Dice to finish
Index: libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.4
libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.5
--- libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java:1.4 Fri Mar
21 04:42:51 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLRenderingSurface.java Wed Jun 18
05:44:38 2003
@@ -39,7 +39,7 @@
import org.nongnu.libvob.gl.*;
public class GLRenderingSurface extends GraphicsAPI.AbstractRenderingSurface {
-public static final String rcsid = "$Id: GLRenderingSurface.java,v 1.4
2003/03/21 09:42:51 tjl Exp $";
+public static final String rcsid = "$Id: GLRenderingSurface.java,v 1.5
2003/06/18 09:44:38 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -80,9 +80,13 @@
}
public void renderStill(VobScene scene, float lod) {
+ // XXX Not sure if this is right place for stats -- need to think about
+ // it some more -- Tjl
+ GL.clearQueuedStatistics();
((GLVobCoorder)scene.coords).renderInterp(surface,
(GLVobMap)scene.map, null,
null, 0, true, true);
+ GL.callQueuedStatistics();
}
VobScene listprev, listnext;
Index: libvob/org/nongnu/libvob/memory/MemoryPartitioner.java
diff -u libvob/org/nongnu/libvob/memory/MemoryPartitioner.java:1.1
libvob/org/nongnu/libvob/memory/MemoryPartitioner.java:1.2
--- libvob/org/nongnu/libvob/memory/MemoryPartitioner.java:1.1 Wed Mar 26
13:13:25 2003
+++ libvob/org/nongnu/libvob/memory/MemoryPartitioner.java Wed Jun 18
05:44:38 2003
@@ -34,6 +34,7 @@
/** A static API which divides the available memory between
* MemoryConsumers.
+ * Note that this is only one possible implementation.
*/
public class MemoryPartitioner {
public static boolean dbg = false;
Index: libvob/src/jni/GLRen.template.java
diff -u libvob/src/jni/GLRen.template.java:1.9
libvob/src/jni/GLRen.template.java:1.10
--- libvob/src/jni/GLRen.template.java:1.9 Mon Jun 9 11:04:36 2003
+++ libvob/src/jni/GLRen.template.java Wed Jun 18 05:44:38 2003
@@ -106,7 +106,7 @@
int flags,
float diceLength, float diceLength2, int diceDepth) {
return createFixedPaperQuad(paper, x0, y0, x1, y1, flags,
- diceLength, diceLength2, diceDepth, null);
+ diceLength, diceLength2, diceDepth, null, 1);
}
Index: libvob/src/jni/TexAccum.cxx
diff -u libvob/src/jni/TexAccum.cxx:1.2 libvob/src/jni/TexAccum.cxx:1.3
--- libvob/src/jni/TexAccum.cxx:1.2 Mon Jun 16 12:16:30 2003
+++ libvob/src/jni/TexAccum.cxx Wed Jun 18 05:44:38 2003
@@ -83,7 +83,7 @@
jf( jint, impl_1TexAccum_1create )
(JNIEnv *env, jclass) {
- TexAccum_JNI *accum = new TexAccum_JNI(env, &statistics, 0);
+ TexAccum_JNI *accum = new TexAccum_JNI(env, 0, 0);
return texaccums.add(accum);
}
Index: libvob/src/stats/Stats.cxx
diff -u libvob/src/stats/Stats.cxx:1.1 libvob/src/stats/Stats.cxx:1.2
--- libvob/src/stats/Stats.cxx:1.1 Mon Jun 16 12:16:30 2003
+++ libvob/src/stats/Stats.cxx Wed Jun 18 05:44:38 2003
@@ -90,11 +90,13 @@
{
}
Collector::~Collector() {
- stats->toBeDeleted(this);
+ if(stats)
+ stats->toBeDeleted(this);
}
void Collector::gotStatistics() {
- stats->triggered(this);
+ if(stats)
+ stats->triggered(this);
}
}
Index: libvob/src/stats/TexAccum.cxx
diff -u libvob/src/stats/TexAccum.cxx:1.1 libvob/src/stats/TexAccum.cxx:1.2
--- libvob/src/stats/TexAccum.cxx:1.1 Mon Jun 16 12:16:30 2003
+++ libvob/src/stats/TexAccum.cxx Wed Jun 18 05:44:38 2003
@@ -37,7 +37,7 @@
clear();
}
- void TexAccum::add(ZPt &p1, ZPt &p2, ZPt &p3, Pt &t1, Pt &t2, Pt &t3) {
+ void TexAccum::add(ZPt &p1, ZPt &p2, ZPt &p3, Pt &t1, Pt &t2, Pt &t3,
float texAreaMult) {
Vec vp1 = Vec(p2) - Vec(p1);
Vec vp2 = Vec(p3) - Vec(p1);
@@ -45,7 +45,7 @@
Vec vt2 = t3 - t2;
double parea = fabs(vp1.cross(vp2)) / 2;
- double tarea = fabs(vt1.cross(vt2)) / 2;
+ double tarea = texAreaMult * fabs(vt1.cross(vt2)) / 2;
if(parea < 1) return;
Index: libvob/test/vob/gl/texaccum.test
diff -u libvob/test/vob/gl/texaccum.test:1.3
libvob/test/vob/gl/texaccum.test:1.4
--- libvob/test/vob/gl/texaccum.test:1.3 Mon Jun 16 12:16:30 2003
+++ libvob/test/vob/gl/texaccum.test Wed Jun 18 05:44:38 2003
@@ -33,7 +33,7 @@
def al(accum):
return [accum.get(i) for i in range(0, 20)]
-def prep():
+def prep(mult = 1):
vs = getvs()
vs.map.put(vob.vobs.SolidBackdropVob(Color.black))
@@ -44,7 +44,7 @@
print accum.get(0)
quad = vob.gl.GLRen.createFixedPaperQuad(paper,
- 0, 0, 1, 1, 0, 1, 1, 10, accum)
+ 0, 0, 1, 1, 0, 1, 1, 10, accum, mult)
return (vs, accum, quad)
@@ -70,6 +70,18 @@
accum.clear()
+def testAreaMult():
+ (vs, accum, quad) = prep(1);
+ (vs4, accum4, quad4) = prep(4);
+ cs = vs.orthoCS(0, "A", 0, 10, 10, 10, 10)
+ vs.put(quad, cs)
+ vs.put(quad4, cs)
+ render(vs)
+ l = al(accum)
+ l4 = al(accum4)
+ assert l[2] == 0 and l[3] != 0 and l[4] == 0
+ assert l4[1] == 0 and l4[2] != 0 and l4[3] == 0
+
def testNonLinear():
(vs, accum, quad) = prep()
@@ -83,6 +95,7 @@
l = al(accum)
assert l[10] != 0
assert l[9] != 0
+
assert l[8] != 0
assert l[7] == 0
assert l[11] == 0
@@ -104,22 +117,13 @@
assert len(cb.list) == 0
quad = vob.gl.GLRen.createFixedPaperQuad(paper,
- 0, 0, 1, 1, 0, 1, 1, 10, accum)
+ 0, 0, 1, 1, 0, 1, 1, 10, accum, 1)
cs = vs.orthoCS(0, "A", 0, 10, 10, 100, 100)
vs.put(quad, cs)
+ # Rendering triggers clearing and callback.
+
render(vs)
- assert len(cb.list) == 0
- vob.gl.GL.clearQueuedStatistics()
- assert len(cb.list) == 0
- vob.gl.GL.callQueuedStatistics()
- assert len(cb.list) == 0
-
- render(vs)
- assert len(cb.list) == 0
- vob.gl.GL.callQueuedStatistics()
- assert len(cb.list) == 1
- vob.gl.GL.clearQueuedStatistics()
assert len(cb.list) == 1
assert cb.list[0] == "1"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/stats/TexAccum.hxx include/v...,
Tuomas J. Lukka <=