[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/librenderables/Re...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/librenderables/Re... |
Date: |
Wed, 25 Sep 2002 10:45:44 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/09/25 10:45:43
Modified files:
gfx/jni : GzzGL-jni.cxx
gfx/librenderables: Renderables.hxx renderables.py
gfx/libutil : Vec23.hxx
gzz/client : Screen.java
gzz/client/awt : AWTScreen.java
gzz/client/gl : GLScreen.java
gzz/gfx/gl : GL.java GLVanishingClient.java
GLVobCoorder.java
gzz/modules/pp : PlaneView.java ViewportVob.java Win.java
gzz/view : CellVobFactory.java DimDecorator.java
LastOpDecorator.java RowColView.java
TextCellContentView.java
VobVanishingClient.java
gzz/vob : AffineVobCoorder.java HBroken.java
LinebreakingUtil.java OrthoCoorder.java
OrthoCoordsys.java OrthoCoordsysMap.java
OrthoDepthSorter.java VobCoorder.java
VobScene.java
test/gzz/vob : TestLBChain.java TestVobScene.java
Added files:
gfx/libcoords : Coords.cxx Coords.hxx
gfx/libfisheye : Fisheye.hxx
Log message:
BIG BIG commit which DOES break a lot of things. Making an omelette:
real hierarchical coordinate systems for GL, with more generalized stuff and
nonlinear coordsys.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libfisheye/Fisheye.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.61&tr2=1.62&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/Vec23.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/Screen.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/awt/AWTScreen.java.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/gl/GLScreen.java.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVanishingClient.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PlaneView.java.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/ViewportVob.java.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/Win.java.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellVobFactory.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/DimDecorator.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/LastOpDecorator.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/RowColView.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VobVanishingClient.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/AffineVobCoorder.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/HBroken.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/LinebreakingUtil.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoorder.java.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoordsys.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoordsysMap.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoDepthSorter.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/VobCoorder.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/VobScene.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/TestLBChain.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/TestVobScene.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -c gzz/gfx/jni/GzzGL-jni.cxx:1.32 gzz/gfx/jni/GzzGL-jni.cxx:1.33
*** gzz/gfx/jni/GzzGL-jni.cxx:1.32 Wed Sep 25 08:42:18 2002
--- gzz/gfx/jni/GzzGL-jni.cxx Wed Sep 25 10:45:43 2002
***************
*** 29,35 ****
using Renderables::Renderable1;
using Renderables::Renderable2;
using Renderables::TextRenderer;
- using Renderables::AffineCoords;
// XXX MEMLEAK
struct RealFont {
--- 29,34 ----
***************
*** 54,60 ****
extern ObjectStorer<Paper::Paper> papers;
! Renderables::Renderer<AffineCoords> renderer;
Mosaic::MosaicBuilder *mosaicbuilder;
--- 53,59 ----
extern ObjectStorer<Paper::Paper> papers;
! Renderables::Renderer renderer;
Mosaic::MosaicBuilder *mosaicbuilder;
***************
*** 819,828 ****
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_renderImpl
(JNIEnv *env, jclass, jint window,
! jintArray codes, jfloatArray pts1, jintArray indices2,
! jfloatArray pts2,
! jint numpts, jfloat fract, jboolean standardcoords,
! jboolean showFinal) {
DBG(dbg) << "RENDER\n";
GLERR
if(standardcoords)
--- 818,829 ----
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_renderImpl
(JNIEnv *env, jclass, jint window,
! jint numinds,
! jintArray j_inds1, jfloatArray j_pts1,
! jintArray j_interpinds,
! jintArray j_inds2, jfloatArray j_pts2,
! jintArray j_codes,
! jfloat fract, jboolean standardcoords, jboolean showFinal) {
DBG(dbg) << "RENDER\n";
GLERR
if(standardcoords)
***************
*** 832,848 ****
sizeof(jfloat) != sizeof(float))
env->FatalError("Invalid data type sizes!");
! jint *ncodes = env->GetIntArrayElements(codes, 0);
! jfloat *npts1 = env->GetFloatArrayElements(pts1, 0);
! jint *ninds2 = 0;
! if(indices2 != 0) {
! ninds2 = env->GetIntArrayElements(indices2, 0);
}
! jfloat *npts2 = env->GetFloatArrayElements(pts2, 0);
DBG(dbg) << "Got data\n";
! renderer.setPoints(numpts, npts1, (int *)ninds2, npts2, fract,
showFinal);
DBG(dbg) << "Set datapoints\n";
--- 833,858 ----
sizeof(jfloat) != sizeof(float))
env->FatalError("Invalid data type sizes!");
! jint *inds1 = env->GetIntArrayElements(j_inds1, 0);
! jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0);
! jint *interpinds = env->GetIntArrayElements(j_interpinds, 0);
!
! jint *inds2 = 0;
! jfloat *pts2 = 0;
! if(j_inds2 != 0) {
! inds2 = env->GetIntArrayElements(j_inds2, 0);
! pts2 = env->GetFloatArrayElements(j_pts2, 0);
}
!
! jint *codes = env->GetIntArrayElements(j_codes, 0);
DBG(dbg) << "Got data\n";
! renderer.setPoints(numinds,
! inds1, pts1,
! interpinds,
! inds2, pts2,
! fract, showFinal);
DBG(dbg) << "Set datapoints\n";
***************
*** 857,874 ****
GLERR
DBG(dbg) << "Did stdcoords\n";
! renderer.renderScene((int *)ncodes, renderable0s, renderable1s,
renderable2s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
! env->ReleaseIntArrayElements(codes, ncodes, JNI_ABORT);
!
! env->ReleaseFloatArrayElements(pts1, npts1, JNI_ABORT);
! env->ReleaseFloatArrayElements(pts2, npts2, JNI_ABORT);
! if(indices2 != 0) {
! env->ReleaseIntArrayElements(indices2, ninds2, JNI_ABORT);
}
DBG(dbg) << "Did releasearrays\n";
GLERR
--- 867,886 ----
GLERR
DBG(dbg) << "Did stdcoords\n";
! renderer.renderScene((int *)codes, renderable0s, renderable1s,
renderable2s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
! env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT);
! env->ReleaseIntArrayElements(j_inds1, inds1, JNI_ABORT);
! env->ReleaseFloatArrayElements(j_pts1, pts1, JNI_ABORT);
! env->ReleaseIntArrayElements(j_interpinds, interpinds, JNI_ABORT);
!
! if(inds2 != 0) {
! env->ReleaseIntArrayElements(j_inds2, inds2, JNI_ABORT);
! env->ReleaseFloatArrayElements(j_pts2, pts2, JNI_ABORT);
}
DBG(dbg) << "Did releasearrays\n";
GLERR
***************
*** 888,896 ****
}
JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl
! (JNIEnv *env, jclass, jint window,
! jintArray codes, jfloatArray pts1,
! jint numpts, jboolean standardcoords, jint iters) {
DBG(dbg) << "RENDER\n";
GLERR
if(standardcoords)
--- 900,910 ----
}
JNIEXPORT jfloat JNICALL Java_gzz_gfx_gl_GL_timeRenderImpl
! (JNIEnv *env, jclass, jint window, jint iters,
! jint numinds,
! jintArray j_inds1, jfloatArray j_pts1,
! jintArray j_codes,
! jboolean standardcoords) {
DBG(dbg) << "RENDER\n";
GLERR
if(standardcoords)
***************
*** 900,911 ****
sizeof(jfloat) != sizeof(float))
env->FatalError("Invalid data type sizes!");
! jint *ncodes = env->GetIntArrayElements(codes, 0);
! jfloat *npts1 = env->GetFloatArrayElements(pts1, 0);
DBG(dbg) << "Got data\n";
! renderer.setPoints(numpts, npts1);
DBG(dbg) << "Set datapoints\n";
--- 914,928 ----
sizeof(jfloat) != sizeof(float))
env->FatalError("Invalid data type sizes!");
! jint *inds1 = env->GetIntArrayElements(j_inds1, 0);
! jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0);
!
! jint *codes = env->GetIntArrayElements(j_codes, 0);
DBG(dbg) << "Got data\n";
! renderer.setPoints(numinds,
! inds1, pts1);
DBG(dbg) << "Set datapoints\n";
***************
*** 919,929 ****
}
GLERR
- DBG(dbg) << "Did stdcoords\n";
double t0 = getTime();
for (int i = 0; i < iters; i++) {
! renderer.renderScene((int *)ncodes, renderable0s, renderable1s,
renderable2s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
--- 936,945 ----
}
GLERR
double t0 = getTime();
for (int i = 0; i < iters; i++) {
! renderer.renderScene((int *)codes, renderable0s, renderable1s,
renderable2s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
***************
*** 932,940 ****
float t = t1 - t0;
DBG(dbg) << "The time was " << t << " [" << t0 << " - " << t1 << "]\n";
! env->ReleaseIntArrayElements(codes, ncodes, JNI_ABORT);
! env->ReleaseFloatArrayElements(pts1, npts1, JNI_ABORT);
DBG(dbg) << "Did releasearrays\n";
GLERR
--- 948,957 ----
float t = t1 - t0;
DBG(dbg) << "The time was " << t << " [" << t0 << " - " << t1 << "]\n";
! env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT);
! env->ReleaseIntArrayElements(j_inds1, inds1, JNI_ABORT);
! env->ReleaseFloatArrayElements(j_pts1, pts1, JNI_ABORT);
DBG(dbg) << "Did releasearrays\n";
GLERR
***************
*** 943,951 ****
releaseWindow();
}
!
! return t;
}
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_setDebugVar
(JNIEnv *env, jclass, jstring name, jint value) {
--- 960,971 ----
releaseWindow();
}
! return t;
}
+
+
+
+
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_setDebugVar
(JNIEnv *env, jclass, jstring name, jint value) {
Index: gzz/gfx/librenderables/Renderables.hxx
diff -c gzz/gfx/librenderables/Renderables.hxx:1.12
gzz/gfx/librenderables/Renderables.hxx:1.13
*** gzz/gfx/librenderables/Renderables.hxx:1.12 Tue Sep 17 07:14:05 2002
--- gzz/gfx/librenderables/Renderables.hxx Wed Sep 25 10:45:43 2002
***************
*** 14,19 ****
--- 14,21 ----
#include "libcolor/spaces.hxx"
#include "libtext/Text.hxx"
+ #include "libcoords/Coords.hxx"
+
//#include <map> // XXX: used by ../demo/clamptexture.cxx hack
#define GLERR { int er = glGetError(); if(er != GL_NO_ERROR) \
***************
*** 98,226 ****
void setStandardCoordinates(Vec windowSize);
- /** A general affine coordinate system.
- */
- struct AffineCoords {
- Pt center;
- Vec x;
- Vec y;
- float z;
- AffineCoords() { }
- AffineCoords(Pt center, Vec x, Vec y) : center(center), x(x), y(y) {}
-
- /** Create a new affinecoords that contains an orthogonal
transformation before
- * the coords.
- */
- AffineCoords(float wmult, float hmult, float xoffs, float yoffs, float
zoffs, AffineCoords &other) {
- center = other.center; center += xoffs * other.x; center += yoffs *
other.y;
- x = wmult * other.x;
- y = hmult * other.y;
- z = other.z + zoffs;
- }
-
- /** Return the inverse of this coordinate system
- */
- AffineCoords getInverse() const {
- float m = 1.0 / (x.x * y.y - x.y * y.x);
- AffineCoords r(Pt(0, 0), Vec(m * y.y, -m * x.y), Vec(-m * y.x, m *
x.x));
- r.center -= center.x * r.x + center.y * r.y;
- r.z = -z;
- return r;
- }
-
- void dump() {
- cout << "Affinecoords: ";
- cout << center << " " << x << " " << y << " " << z <<"\n\n";
- }
-
- enum { nFloatParams = 7 };
- void load(float *f) {
- center = Pt(f[0], f[1]);
- x = Vec(f[2], f[3]);
- y = Vec(f[4], f[5]);
- z = f[6];
- }
-
- void vertex(const ZPt &p) const {
- ZPt tmp = transform(p);
- // std::cout << "Affine vertex: "<<tmp<<" z "<<z<<"\n";
- glVertex3f(tmp.x, tmp.y, tmp.z);
- }
- void vertex(const Pt &p) const {
- ZPt tmp = transform(p);
- // std::cout << "Affine vertex: "<<tmp<<" z "<<z<<"\n";
- glVertex3f(tmp.x, tmp.y, tmp.z);
- }
- ZPt transform(const Pt &p) const {
- Pt tmp = center + x * p.x + y * p.y;
- return ZPt(tmp.x, tmp.y, z);
- }
- ZPt transform(const ZPt &p) const {
- Pt tmp = center + x * p.x + y * p.y;
- return ZPt(tmp.x, tmp.y, z + p.z);
- }
- Vec transform(const Vec &p) const {
- return x * p.x + y * p.y;
- }
-
- void performGL_xy() {
- GLfloat matrix[16] = {
- x.x, x.y, 0, 0,
- y.x, y.y, 0, 0,
- 0, 0, 1, 0,
- center.x, center.y, 0, 1
- };
- glMultMatrixf(matrix);
- }
-
- void performGL() {
- GLfloat matrix[16] = {
- x.x, x.y, 0, 0,
- y.x, y.y, 0, 0,
- 0, 0, 1, 0,
- center.x, center.y, z, 1
- };
- glMultMatrixf(matrix);
- }
-
- };
-
- /* A coordinate system which only translates
- * and scales.
- */
- /*
- struct OrthoCoords {
- Pt center;
- float xScale;
- float yScale;
- float z;
- OrthoCoords() { }
- OrthoCoords(Pt center, float xScale, float yScale)
- : center(center), xScale(xScale), yScale(yScale) {}
- void load(float *f) {
- center = Pt(f[0], f[1]);
- xScale = f[2];
- yScale = f[3];
- z = f[4];
- }
- void vertex(const ZPt &p) const {
- Pt tmp = center + Vec(xScale * p.x, yScale * p.y);
- // std::cout << "Ortho vertex: "<<tmp<<" z "<<z<<"\n";
- glVertex3f(tmp.x, tmp.y, z + p.z);
- }
- void vertex(const Pt &p) const {
- Pt tmp = center + Vec(xScale * p.x, yScale * p.y);
- // std::cout << "Ortho vertex: "<<tmp<<" z "<<z<<"\n";
- glVertex3f(tmp.x, tmp.y, z);
- }
- ZPt transform(const Pt &p) const {
- return ZPt(center.x + xScale * p.x,
- center.y + yScale*p.y,
- z);
- }
- };
- */
-
/** An OpenGL thing that can be rendered without a coordinate
* system.
*/
--- 100,105 ----
***************
*** 236,353 ****
*/
struct Renderable1 {
virtual ~Renderable1() { }
! virtual void render(AffineCoords &c) = 0;
! // virtual void render(OrthoCoords &c) = 0;
};
#define IMPLEMENTRENDER1 \
! void render(AffineCoords &c) { renderImpl(c); }
- // void render(OrthoCoords &c) { renderImpl(c); }
/** An OpenGL thing which starts in one coordinate
* system and ends in another. Used for connections.
*/
struct Renderable2 {
virtual ~Renderable2() { }
! virtual void render(AffineCoords &c1, AffineCoords &c2) = 0;
! // virtual void render(OrthoCoords &c1, OrthoCoords &c2) = 0;
};
#define IMPLEMENTRENDER2 \
! virtual void render(AffineCoords &c1, AffineCoords &c2) \
{ renderImpl(c1, c2); } \
- // virtual void render(OrthoCoords &c1, OrthoCoords &c2)
- // { renderImpl(c1, c2); }
- // XXX Move
- inline float lerp(float a, float b, float fract) {
- return a + fract * (b-a);
- }
using std::vector;
! /** Render renderables in interpolated coordinate systems
! * from lists of integers.
! */
! template<class CoordsType> class Renderer {
! vector<float> floatBuffer;
! vector<CoordsType> coordsBuffer;
! vector<bool> coordsValid;
!
! public:
! Renderer() : floatBuffer(), coordsBuffer() { }
!
! void setPoints(int npts, float *points1,
! int *indices2,
! float *points2, float fract,
! bool showFinal) {
! floatBuffer.reserve(npts);
! coordsValid.reserve(npts / CoordsType::nFloatParams);
! for(int i=0; i<npts; i++) {
! int ind2 = i / CoordsType::nFloatParams;
! if(indices2) {
! if(indices2[i / CoordsType::nFloatParams] <= 0) {
! if(showFinal) {
! coordsValid[i / CoordsType::nFloatParams] = true;
! floatBuffer[i] = points1[i];
! } else {
! coordsValid[i / CoordsType::nFloatParams] = false;
! }
! continue;
! } else {
! coordsValid[i / CoordsType::nFloatParams] = true;
! ind2 = indices2[i / CoordsType::nFloatParams];
! }
! } else
! coordsValid[i / CoordsType::nFloatParams] = true;
!
! floatBuffer[i] = lerp(points1[i],
! points2[ind2 * CoordsType::nFloatParams +
! i % CoordsType::nFloatParams],
! fract);
! }
! int ncoords = npts / CoordsType::nFloatParams;
! coordsBuffer.reserve(ncoords);
! for(int i=0; i<ncoords; i++)
! coordsBuffer[i].load( & floatBuffer[i *
CoordsType::nFloatParams] );
}
! void setPoints(int npts, float *points1) {
! floatBuffer.reserve(npts);
! coordsValid.reserve(npts / CoordsType::nFloatParams);
! for(int i=0; i<npts; i++) {
! floatBuffer[i] = points1[i];
! coordsValid[i / CoordsType::nFloatParams] = true;
! }
! int ncoords = npts / CoordsType::nFloatParams;
! coordsBuffer.reserve(ncoords);
! for(int i=0; i<ncoords; i++)
! coordsBuffer[i].load( & floatBuffer[i *
CoordsType::nFloatParams] );
}
-
- /** Render the scene specified.
- * This method is called once per each frame to render
- * everything. The list of integers given is interpreted as
- * indices of renderables and coordinate systems, with
- * the following formats:
- * <pre>
- * renderable0id | RENDERABLE0
- *
- * renderable1id | RENDERABLE1
- * coordinatesystemId
- *
- * renderable2id | RENDERABLE2
- * coordinatesystemId
- * coordinatesystemId
- * </pre>
- * where '|' is bitwise or.
- * Each renderable is only rendered if each of its
- * coordinate systems is valid (set in setPoints).
- * @param codes The identifiers of the objects to render.
- */
void renderScene(int *codes,
ObjectStorer<Renderable0> &r0s,
ObjectStorer<Renderable1> &r1s,
--- 115,160 ----
*/
struct Renderable1 {
virtual ~Renderable1() { }
! virtual void render(Coords::CoordSys &c) = 0;
};
#define IMPLEMENTRENDER1 \
! void render(Coords::CoordSys &c) { renderImpl(c); }
/** An OpenGL thing which starts in one coordinate
* system and ends in another. Used for connections.
*/
struct Renderable2 {
virtual ~Renderable2() { }
! virtual void render(Coords::CoordSys &c1, Coords::CoordSys &c2) = 0;
};
#define IMPLEMENTRENDER2 \
! virtual void render(Coords::CoordSys &c1, Coords::CoordSys &c2) \
{ renderImpl(c1, c2); } \
using std::vector;
! class Renderer {
! Coords::CoordSet coordset;
! public:
! void setPoints( int ninds,
! int *inds1, float *points1,
! int *interpinds,
! int *inds2, float *points2,
! float fract, bool show1) {
! coordset.clean();
! coordset.setPoints(ninds, inds1, points1, interpinds, inds2,
points2, fract, show1);
}
! void setPoints( int ninds, int *inds1, float *points1) {
! coordset.clean();
! coordset.setPoints(ninds, inds1, points1, 0, 0, 0, 0, true);
}
void renderScene(int *codes,
ObjectStorer<Renderable0> &r0s,
ObjectStorer<Renderable1> &r1s,
***************
*** 365,380 ****
}
else if(codes[i] & RENDERABLE1) {
if(dbg) std::cout << "rend1 "<<r1s[code]<<"\n";
! if(coordsValid[codes[i+1]])
! r1s[code]->render(coordsBuffer[codes[i+1]]);
i += 2;
}
else if(codes[i] & RENDERABLE2) {
if(dbg) std::cout << "rend2 "<<r2s[code]<<"\n";
! if(coordsValid[codes[i+1]] &&
! coordsValid[codes[i+2]])
! r2s[code]->render(coordsBuffer[codes[i+1]],
! coordsBuffer[codes[i+2]]);
i += 3;
}
else {
--- 172,188 ----
}
else if(codes[i] & RENDERABLE1) {
if(dbg) std::cout << "rend1 "<<r1s[code]<<"\n";
! Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
! if(cs1)
! r1s[code]->render(*cs1);
i += 2;
}
else if(codes[i] & RENDERABLE2) {
if(dbg) std::cout << "rend2 "<<r2s[code]<<"\n";
! Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
! Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
! if(cs1 && cs2)
! r2s[code]->render(*cs1, *cs2);
i += 3;
}
else {
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.61
gzz/gfx/librenderables/renderables.py:1.62
*** gzz/gfx/librenderables/renderables.py:1.61 Mon Sep 23 14:08:46 2002
--- gzz/gfx/librenderables/renderables.py Wed Sep 25 10:45:43 2002
***************
*** 107,180 ****
{
"Type": "1",
- "Name" : "GLTransformPush1",
- "Data" : "",
- "Params" : "",
- "ParamCode" : """
- """,
- "RenderCode" : """
- glPushMatrix();
- coords1.performGL();
- GLERR
- """,
- },
-
- {
- "Type": "1",
- "Name" : "GLTransformRotatePush",
- "Data" : "",
- "Params" : "",
- "ParamCode" : """
- """,
- "RenderCode" : """
- glPushMatrix();
- glRotatef(
- coords1.center.x, coords1.center.y,
- coords1.x.x, coords1.y.y);
- GLERR
- """,
- },
-
- {
- "Type": "1",
- "Name" : "GLExpScalePush",
- "Data" : "",
- "Params" : "",
- "ParamCode" : """
- """,
- "RenderCode" : """
- glPushMatrix();
- glScalef(
- exp(coords1.z),
- exp(coords1.z),
- 1
- );
- GLERR
- """,
- },
-
-
- {
- "Type": "1",
- "Name" : "GLTransformPushPDiv",
- "Data" : "",
- "Params" : "",
- "ParamCode" : """
- """,
- "RenderCode" : """
- glPushMatrix();
- GLfloat matrix[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 2, 2,
- 0, 0, 3, 3
- };
- glMultMatrixf(matrix);
- GLERR
- """,
- },
- {
- "Type": "1",
"Name" : "LABSlice",
"Data" : "int axis; float value;",
"Params" : "int axis, float value",
--- 107,112 ----
***************
*** 254,264 ****
// Then, go into the second coordinate system.
MATR
if(dbg) coords2.dump();
! coords2.performGL_xy();
MATR
glScalef(1, 1, 0.01);
MATR
! glTranslatef(0, 0, coords1.z-1);
MATR
STKS
--- 186,198 ----
// Then, go into the second coordinate system.
MATR
if(dbg) coords2.dump();
! coords2.performGL();
MATR
+ ZPt zp = coords1.transform(ZPt(0,0,0));
+ glTranslatef(0, 0, -zp.z-1);
glScalef(1, 1, 0.01);
MATR
! glTranslatef(0, 0, zp.z-1);
MATR
STKS
***************
*** 346,353 ****
"Params": "float dz1, float dz2",
"ParamCode": "this->dz1 = dz1; this->dz2 = dz2;",
"RenderCode" : """
! ZPt p1 = coords1.transform(Pt(0,0));
! ZPt p2 = coords2.transform(Pt(0,0));
p1.z += dz1;
p2.z += dz2;
glBegin(GL_LINE_STRIP);
--- 280,287 ----
"Params": "float dz1, float dz2",
"ParamCode": "this->dz1 = dz1; this->dz2 = dz2;",
"RenderCode" : """
! ZPt p1 = coords1.transform(ZPt(0,0,0));
! ZPt p2 = coords2.transform(ZPt(0,0,0));
p1.z += dz1;
p2.z += dz2;
glBegin(GL_LINE_STRIP);
***************
*** 404,412 ****
DBG(dbg) << "Paper\\n";
GLERR
! ZPt paperorigin = coords2.transform(Pt(0, 0));
! ZVec paperx = coords2.transform(Pt(1, 0)) - paperorigin;
! ZVec papery = coords2.transform(Pt(0, 1)) - paperorigin;
Paper::LightParam lightParam;
lightParam.orig = paperorigin-ZPt(0,0,0);
--- 338,346 ----
DBG(dbg) << "Paper\\n";
GLERR
! ZPt paperorigin = coords2.transform(ZPt(0, 0, 0));
! ZVec paperx = coords2.transform(ZPt(1, 0, 0)) - paperorigin;
! ZVec papery = coords2.transform(ZPt(0, 1, 0)) - paperorigin;
Paper::LightParam lightParam;
lightParam.orig = paperorigin-ZPt(0,0,0);
***************
*** 463,603 ****
{
"Type" : "2",
- "Name": "FisheyePaperQuad",
- "Data": "Paper::Paper* paper; float x0, y0, x1, y1; int gridx, gridy,
bfunc;",
- "Params" : """
- Paper paper, float x0, float y0, float x1, float y1, int gridx, int
gridy, int bulgetype
- """,
- "ParamCode" : """
- this->paper = paper;
- this->x0 = x0;
- this->y0 = y0;
- this->x1 = x1;
- this->y1 = y1;
- this->gridx = gridx;
- this->gridy = gridy;
- this->bfunc = bulgetype;
- """,
- "ExtraClass" : """
- inline ZPt bulge(ZPt& v) const {
- float r2 = v.x * v.x + v.y * v.y;
- float m = 1;
- switch (bfunc) {
- default:
- break;
-
- case 0:
- //For given z, the magnification range is [ 1 - z/8, 1 +
z ]
- m = 1 + v.z / (1 + r2);
- break;
-
- case 1:
- //For given z, the magnification range is [ 1, 1 + z ]
- m = 1 + 0.5 * v.z / (1 + r2);
- if (r2 > 0) {
- float r = sqrt(r2);
- m += 0.5 * v.z * atan(r) / r;
- }
- break;
-
- case 2:
- //For given z, the magnification range is [ 1, 1 + z ]
- if (r2 > 0) {
- float r = sqrt(r2);
- m += v.z * atan(r) / r;
- }
- break;
-
- case 3:
- // Anistropic PDF zoom
- {
- v.x += v.z * atan(v.x / (1+v.y*v.y) );
- if (r2 > 0) {
- float r = sqrt(r2);
- v.y *= 1 + v.z * atan(r) / r;
- }
- return v;
- }
-
- }
-
- // Modulate distance from origin
- return ZPt(m * v.x, m * v.y, v.z);
-
- }
- ZPt bulge_inv(ZPt& p) const {
- // XXX
- return p;
- }
- """,
- "RenderCode" : """
- DBG(dbg) << "Paper\\n";
- GLERR
-
- ZPt paperorigin = coords1.transform(Pt(0, 0));
- ZVec paperx = coords1.transform(Pt(1, 0)) - paperorigin;
- ZVec papery = coords1.transform(Pt(0, 1)) - paperorigin;
-
- AffineCoords cs2inv = coords2.getInverse();
-
- Paper::LightParam lightParam;
- lightParam.orig = paperorigin-ZPt(0,0,0);
- lightParam.e0 = paperx;
- lightParam.e1 = papery;
- lightParam.e2 = ZVec(0,0,paperx.length());
-
- lightParam.Light = ZVec(-1,-1,1);
- lightParam.Light_w = 0.0;
-
- if(dbg) {
- cout << "FisheyePaperquad: " <<
- lightParam.orig << " " <<
- lightParam.e0 << " " <<
- lightParam.e1 << " " <<
- lightParam.e2 << " " <<
- "\\nx0,x1,y0,y1: " <<
- x0 << " " << x1 << " " <<
- y0 << " " << y1 << "\\n"
- ;
- }
- GLERR
-
- for(Paper::Paper::iterator it = paper->begin(); it != paper->end();
++it) {
- if (dbg) cout << "Pass\\n";
- (*it).setUpVP(&lightParam);
-
- float xstep = (x1 - x0) / gridx;
- float ystep = (y1 - y0) / gridy;
-
- for (float y_ = y0; y_ + ystep <= y1; y_ += ystep) {
- glBegin(GL_QUAD_STRIP);
- for (float x = x0; x <= x1; x += xstep) {
- int i = 0;
- for (float y = y_; i < 2; i++, y += ystep) {
- glTexCoord2f(x, y);
-
- // Map (x,y) into coords2 as v
-
- ZPt pos = coords1.transform(Pt(x,y));
- ZPt v = cs2inv.transform(pos);
- v.z = 1/(coords2.z);
- coords2.vertex(bulge(v));
- }
- }
- glEnd();
- }
-
- GLERR
- (*it).tearDownVP();
- GLERR
- }
-
- GLERR
- """,
- } ,
-
- {
- "Type" : "2",
"Name": "BasisPaperQuad",
"Data": "Paper::Paper* paper; CallGLCode tex0code, tex1code, isectcode;
float x0, y0, x1, y1;",
"Params" : """
--- 397,402 ----
***************
*** 617,623 ****
"ExtraClass" : """
//#include "../demo/clamptexture.cxx"
""",
! "RenderCode" : """
DBG(dbg) << "Paper\\n";
GLERR
--- 416,423 ----
"ExtraClass" : """
//#include "../demo/clamptexture.cxx"
""",
! "RenderCode" : "int i = 0; i++;",
! "BLAH": """
DBG(dbg) << "Paper\\n";
GLERR
***************
*** 726,732 ****
(1 - f) * a.y + f * b.y);
}
""",
! "RenderCode" : """
DBG(dbg) << "Irregular quad\\n";
AffineCoords &oldcs2 = coords2;
--- 526,533 ----
(1 - f) * a.y + f * b.y);
}
""",
! "RenderCode" : "int i=0; i++;",
! "BLAH": """
DBG(dbg) << "Irregular quad\\n";
AffineCoords &oldcs2 = coords2;
***************
*** 903,919 ****
"ExtraClass" : """
template<class Coords> struct Vertexer {
const Coords &c;
! Vertexer(Coords &c) : c(c) { }
template<class T> void operator()(const T &x, const T &y) {
! ZPt tmp(x, y, 0);
c.vertex(tmp);
}
};
""",
"RenderCode" : """
! Coords tcoords(widthmul, heightmul, origin.x, origin.y, origin.z,
! coords1);
! Vertexer<Coords> v(tcoords);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
Text::renderIter(*r, txt.begin(), txt.end(),
--- 704,719 ----
"ExtraClass" : """
template<class Coords> struct Vertexer {
const Coords &c;
! float wmul, hmul;
! Vertexer(Coords &c, float wmul, float hmul) : c(c), wmul(wmul),
hmul(hmul) { }
template<class T> void operator()(const T &x, const T &y) {
! ZPt tmp(x * wmul, y * hmul, 0);
c.vertex(tmp);
}
};
""",
"RenderCode" : """
! Vertexer<Coords> v(coords1, widthmul, heightmul);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
Text::renderIter(*r, txt.begin(), txt.end(),
***************
*** 966,974 ****
};
""",
"RenderCode" : """
! Coords tcoords(widthmul, heightmul, origin.x, origin.y, origin.z,
! coords1);
! Vertexer<Coords> v(tcoords, squishx);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
Text::renderIter(*r, txt.begin(), txt.end(),
--- 766,772 ----
};
""",
"RenderCode" : """
! Vertexer<Coords> v(coords1, squishx); // XXX widthmul, heightmul
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
Text::renderIter(*r, txt.begin(), txt.end(),
***************
*** 994,1002 ****
--- 792,802 ----
""",
"RenderCode" : """
#ifdef GL_VERTEX_PROGRAM_NV
+ /*
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, ind,
coords1.center.x, coords1.center.y,
coords1.x.x, coords1.y.y);
+ */
#endif
"""
},
Index: gzz/gfx/libutil/Vec23.hxx
diff -c gzz/gfx/libutil/Vec23.hxx:1.7 gzz/gfx/libutil/Vec23.hxx:1.8
*** gzz/gfx/libutil/Vec23.hxx:1.7 Fri Sep 13 07:48:31 2002
--- gzz/gfx/libutil/Vec23.hxx Wed Sep 25 10:45:43 2002
***************
*** 65,71 ****
T x, y, z;
Point3() : x(0), y(0), z(0) { }
Point3(T x, T y, T z) : x(x), y(y), z(z) { }
! Point3(Point<T> &p, T z) : x(p.x), y(p.y), z(z) { }
Vector3<T> operator-(const Point3 &p) const {
return Vector3<T>(x - p.x, y - p.y, z - p.z); }
Point3<T> operator+(const Vector3<T> v)
--- 65,71 ----
T x, y, z;
Point3() : x(0), y(0), z(0) { }
Point3(T x, T y, T z) : x(x), y(y), z(z) { }
! Point3(Point<T> &p, T z = 0) : x(p.x), y(p.y), z(z) { }
Vector3<T> operator-(const Point3 &p) const {
return Vector3<T>(x - p.x, y - p.y, z - p.z); }
Point3<T> operator+(const Vector3<T> v)
***************
*** 177,182 ****
--- 177,186 ----
typedef Point3<float> ZPt;
typedef Vector<float> Vec;
typedef Vector3<float> ZVec;
+
+ template<class X, class Y, class Z> inline float lerp(X a, Y b, Z fract) {
+ return a + fract * (b-a);
+ }
}
#endif
Index: gzz/gzz/client/Screen.java
diff -c gzz/gzz/client/Screen.java:1.12 gzz/gzz/client/Screen.java:1.13
*** gzz/gzz/client/Screen.java:1.12 Thu Aug 29 05:41:16 2002
--- gzz/gzz/client/Screen.java Wed Sep 25 10:45:43 2002
***************
*** 40,46 ****
*/
public class Screen implements AbstractUpdateManager.Window {
! public static final String rcsid = "$Id: Screen.java,v 1.12 2002/08/29
09:41:16 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 40,46 ----
*/
public class Screen implements AbstractUpdateManager.Window {
! public static final String rcsid = "$Id: Screen.java,v 1.13 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 88,97 ****
--- 88,100 ----
public boolean hasEndState() { return next != null; }
public boolean animUseful() {
+ return true;
+ /* XXX
if(prev != null && next != null)
return prev.coords.needInterp(next.coords);
else
return false;
+ */
}
public void changeStartState(float fract) {
Index: gzz/gzz/client/awt/AWTScreen.java
diff -c gzz/gzz/client/awt/AWTScreen.java:1.20
gzz/gzz/client/awt/AWTScreen.java:1.21
*** gzz/gzz/client/awt/AWTScreen.java:1.20 Wed Sep 25 06:56:54 2002
--- gzz/gzz/client/awt/AWTScreen.java Wed Sep 25 10:45:43 2002
***************
*** 34,40 ****
public abstract class AWTScreen
extends GraphicsAPI.Window
implements MouseListener, MouseMotionListener, Obs,
JUpdateManager.EventProcessor {
! public static final String rcsid = "$Id: AWTScreen.java,v 1.20 2002/09/25
10:56:54 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
--- 34,40 ----
public abstract class AWTScreen
extends GraphicsAPI.Window
implements MouseListener, MouseMotionListener, Obs,
JUpdateManager.EventProcessor {
! public static final String rcsid = "$Id: AWTScreen.java,v 1.21 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
***************
*** 53,58 ****
--- 53,59 ----
return new VobScene(
new DefaultVobMap(),
new OrthoCoorder(size.width, size.height),
+ new DefaultVobMatcher(),
this.getGraphicsAPI(),
this,
size
***************
*** 107,112 ****
--- 108,115 ----
*/
static boolean useGlobalCache = false;
static Image globalCache;
+ VobScene listprev, listnext;
+ int[] interplist;
/** Renders a frame of the view animation onto Graphics buffer
*/
***************
*** 163,170 ****
--- 166,181 ----
p("Going to render: "+sc+" "+osc+" "+fract);
if(dbg) sc.dump();
if(dbg) osc.dump();
+
+ if(sc != listprev || osc != listnext) {
+ listprev = sc;
+ listnext = osc;
+ interplist = sc.matcher.interpList(osc.matcher);
+ }
+
((OrthoCoorder)sc.coords).renderVobs((DefaultVobMap)sc.map,
(OrthoCoorder)osc.coords,
+ interplist,
fract,
gr, fg
);
Index: gzz/gzz/client/gl/GLScreen.java
diff -c gzz/gzz/client/gl/GLScreen.java:1.31
gzz/gzz/client/gl/GLScreen.java:1.32
*** gzz/gzz/client/gl/GLScreen.java:1.31 Wed Sep 25 08:27:59 2002
--- gzz/gzz/client/gl/GLScreen.java Wed Sep 25 10:45:43 2002
***************
*** 33,39 ****
import java.util.HashMap;
public class GLScreen extends GraphicsAPI.Window {
! public static final String rcsid = "$Id: GLScreen.java,v 1.31 2002/09/25
12:27:59 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 33,39 ----
import java.util.HashMap;
public class GLScreen extends GraphicsAPI.Window {
! public static final String rcsid = "$Id: GLScreen.java,v 1.32 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 181,186 ****
--- 181,187 ----
VobScene vs = new VobScene(
new GLVobMap(this),
new GLVobCoorder(),
+ new DefaultVobMatcher(),
this.getGraphicsAPI(),
this,
size
***************
*** 223,228 ****
--- 224,233 ----
public void renderStill(VobScene scene, float lod) {
renderAnim(scene, null, 0, lod, true);
}
+
+ VobScene listprev, listnext;
+ int[] interplist;
+
public void renderAnim(VobScene prev, VobScene next, float fract, float
lod,
boolean showFinal) {
if(dbg) pa("glscreen renderanim "+fract+" "+lod);
***************
*** 239,245 ****
sc.dump();
}
! ((GLVobCoorder)sc.coords).renderInterp(window, (GLVobMap)sc.map,
(GLVobCoorder)osc.coords, fract,
true, showFinal);
--- 244,257 ----
sc.dump();
}
! if(sc != listprev || osc != listnext) {
! listprev = sc;
! listnext = osc;
! interplist = sc.matcher.interpList(osc.matcher);
! }
!
! ((GLVobCoorder)sc.coords).renderInterp(window,
! (GLVobMap)sc.map, interplist,
(GLVobCoorder)osc.coords, fract,
true, showFinal);
Index: gzz/gzz/gfx/gl/GL.java
diff -c gzz/gzz/gfx/gl/GL.java:1.6 gzz/gzz/gfx/gl/GL.java:1.7
*** gzz/gzz/gfx/gl/GL.java:1.6 Wed Sep 25 08:27:59 2002
--- gzz/gzz/gfx/gl/GL.java Wed Sep 25 10:45:43 2002
***************
*** 566,600 ****
}
public static void render(
! Window win, int[] codes, float[] pts1, float[] pts2,
! int numpts, float fract, boolean standardcoords,
boolean showFinal) {
! renderImpl(win.getId(), codes, pts1, null, pts2, numpts, fract,
! standardcoords, showFinal);
! }
! public static void render(
! Window win, int[] codes, float[] pts1, int[] indices2,
! float[] pts2,
! int numpts, float fract, boolean standardcoords,
! boolean showFinal) {
! renderImpl(win.getId(), codes, pts1, indices2, pts2, numpts, fract,
! standardcoords, showFinal);
}
private static native void renderImpl(
! int window, int[] codes, float[] pts1, int[] indices2,
! float[] pts2,
! int numpts, float fract, boolean standardcoords,
boolean showFinal);
public static float timeRender(
! Window win, int[] codes, float[] pts1,
! int numpts, boolean standardcoords, int iters) {
! return timeRenderImpl(win.getId(), codes, pts1, numpts,
! standardcoords, iters);
}
private static native float timeRenderImpl(
! int window, int[] codes, float[] pts1,
! int numpts, boolean standardcoords, int iters);
/** Process native events.
* @param wait If false, this function will return once there are no more
--- 566,603 ----
}
public static void render(
! Window win,
! int ninds, int[] inds1, float[] pts1,
! int[] interpinds,
! int[] inds2, float[] pts2,
! int[] codes,
! float fract, boolean standardcoords,
boolean showFinal) {
! renderImpl(win.getId(), ninds, inds1, pts1, interpinds, inds2, pts2,
codes,
! fract, standardcoords, showFinal);
}
private static native void renderImpl(
! int window,
! int ninds, int[] inds1, float[] pts1,
! int[] interpinds,
! int[] inds2, float[] pts2,
! int[] codes,
! float fract, boolean standardcoords,
boolean showFinal);
public static float timeRender(
! Window win, int iters,
! int ninds, int[] inds1, float[] pts1,
! int[] codes,
! boolean standardcoords) {
! return timeRenderImpl(win.getId(), iters,
! ninds, inds1, pts1, codes, standardcoords);
}
private static native float timeRenderImpl(
! int window, int iters,
! int ninds, int[] inds1, float[] pts1,
! int[] codes,
! boolean standardcoords);
/** Process native events.
* @param wait If false, this function will return once there are no more
Index: gzz/gzz/gfx/gl/GLVanishingClient.java
diff -c gzz/gzz/gfx/gl/GLVanishingClient.java:1.10
gzz/gzz/gfx/gl/GLVanishingClient.java:1.11
*** gzz/gzz/gfx/gl/GLVanishingClient.java:1.10 Mon Sep 23 04:24:25 2002
--- gzz/gzz/gfx/gl/GLVanishingClient.java Wed Sep 25 10:45:43 2002
***************
*** 67,78 ****
public void place(Cell c, Object o, float fract, int x0, int y0, int x1,
int y1,
int depth, float rot) {
// p("Place "+c+" "+fract+" "+x0+" "+y0+" "+x1+" "+y1+" "+depth);
! int cs = vs.coords.coordsys(into, c, depth, x0, y0, x1-x0, y1-y0);
vs.map.put(cellImage, cs);
}
public void connect(Cell c1, Cell c2, int dx, int dy) {
! int cs1 = vs.coords.getCoordsys(c1);
! int cs2 = vs.coords.getCoordsys(c2);
if(cs1 <= 0 || cs2 <= 0) return;
if(dx > 0) {
vs.map.put(connHoriz, cs1, cs2);
--- 67,79 ----
public void place(Cell c, Object o, float fract, int x0, int y0, int x1,
int y1,
int depth, float rot) {
// p("Place "+c+" "+fract+" "+x0+" "+y0+" "+x1+" "+y1+" "+depth);
! int cs = vs.coords.coordsys(into, depth, x0, y0, x1-x0, y1-y0);
! vs.matcher.add(cs, c);
vs.map.put(cellImage, cs);
}
public void connect(Cell c1, Cell c2, int dx, int dy) {
! int cs1 = vs.matcher.getCS(c1);
! int cs2 = vs.matcher.getCS(c2);
if(cs1 <= 0 || cs2 <= 0) return;
if(dx > 0) {
vs.map.put(connHoriz, cs1, cs2);
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -c gzz/gzz/gfx/gl/GLVobCoorder.java:1.27
gzz/gzz/gfx/gl/GLVobCoorder.java:1.28
*** gzz/gzz/gfx/gl/GLVobCoorder.java:1.27 Mon Sep 23 04:24:25 2002
--- gzz/gzz/gfx/gl/GLVobCoorder.java Wed Sep 25 10:45:43 2002
***************
*** 29,223 ****
import gzz.client.gl.*;
public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.27 2002/09/23
08:24:25 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
! float[] coordsys = new float[10000];
! int ncoordsys = 7;
! Object[] keys = new Object[10000];
!
! public int getCSIndexAt(float x, float y) {
! throw new Error();
! // for(int i=0; i<ncoordsys; i += 7)
! // ; // XXX
! //return 0;
! }
! HashMap inds = new HashMap();
public int affineCoordsys(
! int into, Object key, float depth,
float cx, float cy,
float x_x, float x_y,
float y_x, float y_y
) {
! if(dbg) pa("AffineCoordSys "+ncoordsys/7+": "+into+" '"+key+"'
"+depth+" --- "+
! cx+" "+cy+" "+x_x+" "+x_y+" "+y_x+" "+y_y);
! if(into != 0) {
! // Transform us into the other coordsys.
! // XXX Not sure about the oblique components!!!
! // XXX This is not the right way to do it, anyway -
! // interpolation is wrong.
! int ind = into * 7;
! /*
! float ncx = coordsys[ind+2] * cx +
! coordsys[ind+3] * cy +
! coordsys[ind];
! float ncy = coordsys[ind+4] * cx +
! coordsys[ind+5] * cy +
! coordsys[ind+1];
! float nx_x = coordsys[ind+2] * x_x +
! coordsys[ind+3] * y_x;
! float nx_y = coordsys[ind+2] * x_y +
! coordsys[ind+3] * y_y;
! float ny_x = coordsys[ind+4] * x_x +
! coordsys[ind+5] * y_x;
! float ny_y = coordsys[ind+4] * x_y +
! coordsys[ind+5] * y_y;
! */
! // Ouch. the AWT implementation just translates -->
! // so will we, for now.
! float ncx = cx + coordsys[ind] - coordsys[ind+2];
! float ncy = cy + coordsys[ind+1] - coordsys[ind+5];
! float nx_x = x_x;
! float nx_y = x_y;
! float ny_x = y_x;
! float ny_y = y_y;
! cx = ncx;
! cy = ncy;
! x_x = nx_x;
! x_y = nx_y;
! y_x = ny_x;
! y_y = ny_y;
! depth = depth + coordsys[ind+6];
! if(dbg) pa("Transformed: "+depth+" --- "+
cx+" "+cy+" "+x_x+" "+x_y+" "+y_x+" "+y_y);
! // a REAL kludge
! if(dbg) pa("Passed key: "+key);
! key = new Integer(
! mix(key.hashCode(),
! keys[into] != null ? 1 : 0,
! keys[into] != null ? keys[into].hashCode() : 0));
! if(dbg) {
! pa("Old key: "+keys[into]);
! pa("New key: "+key);
! }
! }
! coordsys[ncoordsys] = cx;
! coordsys[ncoordsys + 1] = cy;
! coordsys[ncoordsys + 2] = x_x;
! coordsys[ncoordsys + 3] = x_y;
! coordsys[ncoordsys + 4] = y_x;
! coordsys[ncoordsys + 5] = y_y;
! coordsys[ncoordsys + 6] = depth;
! int was = ncoordsys;
! ncoordsys += 7;
! was /= 7;
! keys[was] = key;
! if(key!=null) inds.put(key, new Integer(was));
! return was;
! }
! static public int mix(int i1, int i2, int i3) {
! return (i1 * 5124723 + 9812375) % 5350917 +
! (i2 * 127401 + 897124) % 1128501 +
! (i3 * 317819 + 1897124) % 12501 ;
! }
!
! public Object getKeyAt(VobMap v, float x, float y, float[]
internalcoords) {
! float depth = 100000000;
! Object key = null;
! for(int i=0; i<ncoordsys/7; i++) {
! int ind = i*7;
! float nx = x - coordsys[ind + 0];
! float ny = y - coordsys[ind + 1];
! // XXX Should really invert the matrix...
! double dx = nx / coordsys[ind + 2];
! double dy = ny / coordsys[ind + 5];
! if(Math.abs(dx) <= 1 && Math.abs(dy) <= 1 &&
! coordsys[ind+6] < depth ) {
! key = keys[i];
! depth = coordsys[ind+6];
! if(internalcoords != null) {
! internalcoords[0] = (float)dx;
! internalcoords[1] = (float)dy;
! }
! }
! }
! return key;
! }
! public int getCoordsys(Object key) {
! Integer i = (Integer)inds.get(key);
! if(i==null) return -1;
! return i.intValue();
}
public void dump() {
pa("GLVobCoorder: ");
! for(int i=0; i<ncoordsys/7; i++) {
! int ind = i*7;
String s = "";
! for(int u = ind; u<ind+7; u++)
! s = s + " " + coordsys[u];
! pa(" cs: "+s+" Key: "+keys[i]);
}
}
! GLVobCoorder interpListFor;
! int[] interpList = new int[1000];
!
! public void makeindexlist(GLVobCoorder other) {
! if(interpListFor == other) return ;
! for(int i=0; i<ncoordsys/7; i++) {
! if(keys[i] == null) continue;
! int ind = other.getCoordsys(keys[i]);
! interpList[i] = ind;
! }
! interpListFor = other;
! }
!
! public void renderInterp(GraphicsAPI.Window into, GLVobMap theVobs,
GLVobCoorder other, float fract,
boolean standardcoords, boolean showFinal) {
! renderInterp(((GLScreen)into).getWindow(), theVobs, other, fract,
standardcoords, showFinal);
}
! public void renderInterp(GL.Window into, GLVobMap theVobs,
GLVobCoorder other, float fract,
boolean standardcoords, boolean showFinal) {
! if(other == this) {
! GL.render(into, theVobs.list, coordsys, null,
! coordsys, ncoordsys, fract, standardcoords,
! showFinal);
! } else {
! makeindexlist(other);
! GL.render(into, theVobs.list, coordsys, interpList,
! other.coordsys, ncoordsys, fract,
! standardcoords, showFinal);
! }
}
public float timeRender(GL.Window into, GLVobMap theVobs,
boolean standardcoords, int iters) {
! return GL.timeRender(into, theVobs.list,
! coordsys, ncoordsys, standardcoords, iters);
}
public Vob.RenderInfo getRenderInfo(int cs) {
// XXX
OrthoRenderInfo ri = new OrthoRenderInfo();
! int ind = cs * 7;
! float x = coordsys[ind + 0];
! float y = coordsys[ind + 1];
! float xs = coordsys[ind + 2];
! float ys = coordsys[ind + 5];
ri.setCoords(1, x-xs, y-ys, 2*xs, 2*ys, -1, -1, -1, -1);
return ri;
}
! public boolean needInterp(VobCoorder interpTo) {
// XXX
return true;
}
--- 29,121 ----
import gzz.client.gl.*;
public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.28 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
! float[] floats = new float[10000];
! int nfloats = 0;
!
! int[] inds = new int[5000];
! int ninds = 3; // first 3 ignored.
! public int getCSIndexAt(float x, float y) { return -1; }
public int affineCoordsys(
! int into, float depth,
float cx, float cy,
float x_x, float x_y,
float y_x, float y_y
) {
! if(dbg) pa("AffineCoordSys "+ninds/3+": "+into+" '"+depth+" --- "+
cx+" "+cy+" "+x_x+" "+x_y+" "+y_x+" "+y_y);
! floats[nfloats + 0] = cx;
! floats[nfloats + 1] = cy;
! floats[nfloats + 2] = depth;
! floats[nfloats + 3] = x_x;
! floats[nfloats + 4] = x_y;
! floats[nfloats + 5] = y_x;
! floats[nfloats + 6] = y_y;
! int paramInd = nfloats;
! nfloats += 7;
!
! inds[ninds + 0] = 1; // affine = 1
! inds[ninds + 1] = into;
! inds[ninds + 2] = paramInd;
! int was = ninds / 3;
! ninds += 3;
! return was;
}
public void dump() {
pa("GLVobCoorder: ");
! for(int i=0; i<ninds/3; i++) {
! int ind = i*3;
String s = "";
! for(int u = ind; u<ind+3; u++)
! s = s + " " + inds[u];
! pa(" cs: "+s);
}
}
! public void renderInterp(GraphicsAPI.Window into, GLVobMap theVobs, int[]
csinds,
GLVobCoorder other, float fract,
boolean standardcoords, boolean showFinal) {
! renderInterp(((GLScreen)into).getWindow(), theVobs, csinds, other,
fract,
standardcoords, showFinal);
}
! public void renderInterp(GL.Window into, GLVobMap theVobs, int[] csinds,
GLVobCoorder other, float fract,
boolean standardcoords, boolean showFinal) {
! GL.render(into, ninds, this.inds, this.floats,
! csinds,
! other.inds, other.floats,
! theVobs.list, fract, standardcoords, showFinal);
}
public float timeRender(GL.Window into, GLVobMap theVobs,
boolean standardcoords, int iters) {
! return GL.timeRender(into, iters,
! ninds, inds, floats,
! theVobs.list,
! standardcoords);
}
public Vob.RenderInfo getRenderInfo(int cs) {
// XXX
OrthoRenderInfo ri = new OrthoRenderInfo();
! int ind = inds[cs+2];
! float x = floats[ind + 0];
! float y = floats[ind + 1];
! float xs = floats[ind + 3];
! float ys = floats[ind + 6];
ri.setCoords(1, x-xs, y-ys, 2*xs, 2*ys, -1, -1, -1, -1);
return ri;
}
! public boolean needInterp(VobCoorder interpTo, int[] interpList) {
// XXX
return true;
}
Index: gzz/gzz/modules/pp/PlaneView.java
diff -c gzz/gzz/modules/pp/PlaneView.java:1.44
gzz/gzz/modules/pp/PlaneView.java:1.45
*** gzz/gzz/modules/pp/PlaneView.java:1.44 Thu Aug 29 05:41:16 2002
--- gzz/gzz/modules/pp/PlaneView.java Wed Sep 25 10:45:43 2002
***************
*** 39,45 ****
*/
public class PlaneView {
! public static final String rcsid = "$Id: PlaneView.java,v 1.44 2002/08/29
09:41:16 tjl Exp $";
public static boolean dbg = true;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 39,45 ----
*/
public class PlaneView {
! public static final String rcsid = "$Id: PlaneView.java,v 1.45 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = true;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 180,186 ****
*/
static public Cell getCellAndOffset(VobScene vs, float x, float y, int[]
offsOut) {
float[] ic = new float[2];
! Object k = vs.coords.getKeyAt(vs.map, x, y, ic);
if(k == null || !(k instanceof Cell)) {
pa("Clicked object not cell -- return null "+k);
return null;
--- 180,186 ----
*/
static public Cell getCellAndOffset(VobScene vs, float x, float y, int[]
offsOut) {
float[] ic = new float[2];
! Object k = vs.getKeyAt(x, y, ic);
if(k == null || !(k instanceof Cell)) {
pa("Clicked object not cell -- return null "+k);
return null;
***************
*** 224,231 ****
BgVob bg = BgVob.create(plane);
// Coordinate system 1: the viewport
! int cs1_bg = into.coords.coordsys(0, keys.portBgKey, d+1, x, y, w, h);
! int cs1 = into.coords.coordsys(0, keys.portKey, d, x, y, w, h);
// Coordinate system 2: internals.
// 1) the x and y coordinates in real screen space corresponding to
panx, pany
--- 224,233 ----
BgVob bg = BgVob.create(plane);
// Coordinate system 1: the viewport
! int cs1_bg = into.coords.coordsys(0, d+1, x, y, w, h);
! into.matcher.add(cs1_bg, keys.portBgKey);
! int cs1 = into.coords.coordsys(0, d, x, y, w, h);
! into.matcher.add(cs1, keys.portKey);
// Coordinate system 2: internals.
// 1) the x and y coordinates in real screen space corresponding to
panx, pany
***************
*** 236,244 ****
xorig -= panx * zoom / 1000.0f;
yorig -= pany * zoom / 1000.0f;
! int cs2 = into.coords.coordsys(0, keys.coordKey, 10000,
xorig-zoom/1000.0f, yorig-zoom/1000.0f,
2*zoom/1000.0f, 2*zoom/1000.0f);
VobScene subvs = getPaperScene(into, cursor, leftBuoys, rightBuoys);
keys.setVobScene(subvs);
--- 238,247 ----
xorig -= panx * zoom / 1000.0f;
yorig -= pany * zoom / 1000.0f;
! int cs2 = into.coords.coordsys(0, 10000,
xorig-zoom/1000.0f, yorig-zoom/1000.0f,
2*zoom/1000.0f, 2*zoom/1000.0f);
+ into.matcher.add(cs2, keys.coordKey);
VobScene subvs = getPaperScene(into, cursor, leftBuoys, rightBuoys);
keys.setVobScene(subvs);
Index: gzz/gzz/modules/pp/ViewportVob.java
diff -c gzz/gzz/modules/pp/ViewportVob.java:1.17
gzz/gzz/modules/pp/ViewportVob.java:1.18
*** gzz/gzz/modules/pp/ViewportVob.java:1.17 Mon Sep 23 04:24:25 2002
--- gzz/gzz/modules/pp/ViewportVob.java Wed Sep 25 10:45:43 2002
***************
*** 71,82 ****
if(dbg) p("Viewportvob: "+ext+" "+porig+" "+p11);
if(dbg) vobs.dump();
!
((OrthoCoorder)vobs.coords).renderVobs((DefaultVobMap)vobs.map, null,
0, g, Color.black,
porig.x, porig.y,
(p11.x-porig.x)/1000.0f,
(p11.y-porig.y)/1000.0f);
}
GL.DisplayList displayList;
--- 71,84 ----
if(dbg) p("Viewportvob: "+ext+" "+porig+" "+p11);
if(dbg) vobs.dump();
! if(true) throw new UnsupportedOperationException("ARGH");
! /*
((OrthoCoorder)vobs.coords).renderVobs((DefaultVobMap)vobs.map, null,
0, g, Color.black,
porig.x, porig.y,
(p11.x-porig.x)/1000.0f,
(p11.y-porig.y)/1000.0f);
+ */
}
GL.DisplayList displayList;
***************
*** 100,111 ****
--- 102,116 ----
displayList.startCompile(w);
+ if(true) throw new UnsupportedOperationException("ARGH");
+ /*
((GLVobCoorder)vobs.coords).renderInterp(win,
(GLVobMap)vobs.map,
(GLVobCoorder)vobs.coords,
0,
false,
true);
+ */
displayList.endCompile(w);
Index: gzz/gzz/modules/pp/Win.java
diff -c gzz/gzz/modules/pp/Win.java:1.50 gzz/gzz/modules/pp/Win.java:1.51
*** gzz/gzz/modules/pp/Win.java:1.50 Wed Sep 25 06:56:54 2002
--- gzz/gzz/modules/pp/Win.java Wed Sep 25 10:45:43 2002
***************
*** 36,42 ****
*/
public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.50 2002/09/25 10:56:54
benja Exp $";
public static final boolean dbg = true;
protected static void p(String s) { if(dbg) pa(s); }
protected static void pa(String s) { System.err.println(s); }
--- 36,42 ----
*/
public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.51 2002/09/25 14:45:43
tjl Exp $";
public static final boolean dbg = true;
protected static void p(String s) { if(dbg) pa(s); }
protected static void pa(String s) { System.err.println(s); }
***************
*** 238,244 ****
/** Get the X and Y coordinates in the main viewport of the given mouse
event.
*/
float[] getXYInMain(MouseEvent me, VobKeyer.Main entry) {
! int cs = currentScene.coords.getCoordsys(entry.coordKey);
if(dbg) p("cs: "+cs);
Vob.RenderInfo inf = currentScene.coords.getRenderInfo(cs);
--- 238,244 ----
/** Get the X and Y coordinates in the main viewport of the given mouse
event.
*/
float[] getXYInMain(MouseEvent me, VobKeyer.Main entry) {
! int cs = currentScene.matcher.getCS(entry.coordKey);
if(dbg) p("cs: "+cs);
Vob.RenderInfo inf = currentScene.coords.getRenderInfo(cs);
***************
*** 252,259 ****
try {
p("PP client mouse "+me);
! final Object key = currentScene.coords
! .getKeyAt(currentScene.map, me.getX(), me.getY(), null);
p("Pointed at vob with key "+key);
--- 252,258 ----
try {
p("PP client mouse "+me);
! final Object key = currentScene.getKeyAt(me.getX(), me.getY(), null);
p("Pointed at vob with key "+key);
Index: gzz/gzz/view/CellVobFactory.java
diff -c gzz/gzz/view/CellVobFactory.java:1.9
gzz/gzz/view/CellVobFactory.java:1.10
*** gzz/gzz/view/CellVobFactory.java:1.9 Wed Sep 25 07:25:05 2002
--- gzz/gzz/view/CellVobFactory.java Wed Sep 25 10:45:43 2002
***************
*** 46,52 ****
*/
public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.9 2002/09/25
11:25:05 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 46,52 ----
*/
public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.10
2002/09/25 14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 167,174 ****
Vob.RenderInfo info = v.coords.getRenderInfo(cs);
info.getExtRect(rect);
! final int content_cs = v.coords.coordsys(cs, CONTENT_KEY, 0, 5, 5,
rect.width-10, rect.height-10);
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
if(content != null)
--- 167,175 ----
Vob.RenderInfo info = v.coords.getRenderInfo(cs);
info.getExtRect(rect);
! final int content_cs = v.coords.coordsys(cs, 0, 5, 5,
rect.width-10, rect.height-10);
+ v.matcher.add(content_cs, CONTENT_KEY);
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
if(content != null)
Index: gzz/gzz/view/DimDecorator.java
diff -c gzz/gzz/view/DimDecorator.java:1.3 gzz/gzz/view/DimDecorator.java:1.4
*** gzz/gzz/view/DimDecorator.java:1.3 Fri Sep 13 07:05:39 2002
--- gzz/gzz/view/DimDecorator.java Wed Sep 25 10:45:43 2002
***************
*** 32,38 ****
* vob scene.
*/
public class DimDecorator implements FallbackSceneDecorator {
! String rcsid = "$Id: DimDecorator.java,v 1.3 2002/09/13 11:05:39 benja Exp $";
public static boolean dbg = true;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 32,38 ----
* vob scene.
*/
public class DimDecorator implements FallbackSceneDecorator {
! String rcsid = "$Id: DimDecorator.java,v 1.4 2002/09/25 14:45:43 tjl Exp $";
public static boolean dbg = true;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 59,80 ****
int w = size.width, h = size.height;
// The coordinate system where the lines start
! int orig =
! sc.coords.coordsys(into, origKey, 0, 0, 0, w, h);
// The coordinate systems of the dimensions
int[] targ = {
! sc.coords.coordsys(into, dimKeys[0], 0, w, 0, w, h),
! sc.coords.coordsys(into, dimKeys[1], 0, 0, h, w, h),
! sc.coords.coordsys(into, dimKeys[2], 0, w, h, w, h)
};
for(int i=0; i<3; i++) {
sc.map.put(conn, targ[i], orig);
sc.map.put(bg, targ[i]);
! int cs = sc.coords.coordsys(targ[i], dimKeys[i], 0, 0, 0,
style.getWidth(dims[i].name, 1),
style.getHeight(1));
sc.map.put(new TextVob(style, dims[i].name), cs);
}
--- 59,82 ----
int w = size.width, h = size.height;
// The coordinate system where the lines start
! int orig = sc.coords.coordsys(into, 0, 0, 0, w, h);
! sc.matcher.add(orig, origKey);
// The coordinate systems of the dimensions
int[] targ = {
! sc.coords.coordsys(into, 0, w, 0, w, h),
! sc.coords.coordsys(into, 0, 0, h, w, h),
! sc.coords.coordsys(into, 0, w, h, w, h)
};
for(int i=0; i<3; i++) {
+ sc.matcher.add(targ[i], dimKeys[i]);
sc.map.put(conn, targ[i], orig);
sc.map.put(bg, targ[i]);
! int cs = sc.coords.coordsys(targ[i], 0, 0, 0,
style.getWidth(dims[i].name, 1),
style.getHeight(1));
+ sc.matcher.add(cs, dimKeys[i]);
sc.map.put(new TextVob(style, dims[i].name), cs);
}
***************
*** 85,91 ****
sc.coords.getRenderInfo(into).getExtRect(rect);
float vw = style.getWidth(name, 1.6f) + 10, vh =
style.getHeight(1.6f);
float vx = rect.width - vw;
! int cs = sc.coords.coordsys(into, viewKey, 0, vx, 10, vw, vh);
sc.map.put(new TextVob(style, 1.6f, name), cs);
}
}
--- 87,94 ----
sc.coords.getRenderInfo(into).getExtRect(rect);
float vw = style.getWidth(name, 1.6f) + 10, vh =
style.getHeight(1.6f);
float vx = rect.width - vw;
! int cs = sc.coords.coordsys(into, 0, vx, 10, vw, vh);
! sc.matcher.add(cs, viewKey);
sc.map.put(new TextVob(style, 1.6f, name), cs);
}
}
Index: gzz/gzz/view/LastOpDecorator.java
diff -c gzz/gzz/view/LastOpDecorator.java:1.8
gzz/gzz/view/LastOpDecorator.java:1.9
*** gzz/gzz/view/LastOpDecorator.java:1.8 Wed Sep 25 07:20:06 2002
--- gzz/gzz/view/LastOpDecorator.java Wed Sep 25 10:45:43 2002
***************
*** 32,38 ****
* directional op entered.
*/
public class LastOpDecorator implements FallbackSceneDecorator {
! String rcsid = "$Id: LastOpDecorator.java,v 1.8 2002/09/25 11:20:06 benja Exp
$";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 32,38 ----
* directional op entered.
*/
public class LastOpDecorator implements FallbackSceneDecorator {
! String rcsid = "$Id: LastOpDecorator.java,v 1.9 2002/09/25 14:45:43 tjl Exp
$";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 106,112 ****
float x = padding;
float y = size.height - padding - h;
! int cs = sc.coords.coordsys(into, key, 0, x, y, w, h);
br.put(sc, cs);
--- 106,113 ----
float x = padding;
float y = size.height - padding - h;
! int cs = sc.coords.coordsys(into, 0, x, y, w, h);
! sc.matcher.add(cs, key);
br.put(sc, cs);
Index: gzz/gzz/view/RowColView.java
diff -c gzz/gzz/view/RowColView.java:1.2 gzz/gzz/view/RowColView.java:1.3
*** gzz/gzz/view/RowColView.java:1.2 Mon Aug 19 10:45:48 2002
--- gzz/gzz/view/RowColView.java Wed Sep 25 10:45:43 2002
***************
*** 83,93 ****
int[][] cs = new int[n[main]][n[second]];
int k[] = new int[2];
for(k[main]=0; k[main] < n[main]; k[main]++)
! for(k[second]=0; k[second] < n[second]; k[second]++)
cs[k[main]][k[second]] = sc.coords.coordsys(
! into, grid[k[main]][k[second]], 0,
xoffs + k[0]*xroom, yoffs + k[1]*yroom,
cellSize.width, cellSize.height);
fact.setSpace(center.space);
for(int i=0; i<n[main]; i++)
--- 83,96 ----
int[][] cs = new int[n[main]][n[second]];
int k[] = new int[2];
for(k[main]=0; k[main] < n[main]; k[main]++)
! for(k[second]=0; k[second] < n[second]; k[second]++) {
cs[k[main]][k[second]] = sc.coords.coordsys(
! into, 0,
xoffs + k[0]*xroom, yoffs + k[1]*yroom,
cellSize.width, cellSize.height);
+ sc.matcher.add(cs[k[main]][k[second]],
+ grid[k[main]][k[second]]);
+ }
fact.setSpace(center.space);
for(int i=0; i<n[main]; i++)
Index: gzz/gzz/view/TextCellContentView.java
diff -c gzz/gzz/view/TextCellContentView.java:1.9
gzz/gzz/view/TextCellContentView.java:1.10
*** gzz/gzz/view/TextCellContentView.java:1.9 Sat Sep 14 10:07:01 2002
--- gzz/gzz/view/TextCellContentView.java Wed Sep 25 10:45:43 2002
***************
*** 37,43 ****
*/
public class TextCellContentView implements CellContentView {
! public static final String rcsid = "$Id: TextCellContentView.java,v 1.9
2002/09/14 14:07:01 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 37,43 ----
*/
public class TextCellContentView implements CellContentView {
! public static final String rcsid = "$Id: TextCellContentView.java,v 1.10
2002/09/25 14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 87,94 ****
else skew = (- left + middle);
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
! int skewedcs =
! v.coords.coordsys(cs, key, 0, skew, 0, width, box.height);
placeVob(c, v, skewedcs, brBefore, brAfter, offs, context, scale);
}
--- 87,93 ----
else skew = (- left + middle);
Object key = (line < KEY.length) ? KEY[line] : new Integer(line+1);
! int skewedcs = v.coordsys(cs, key, 0, skew, 0, width, box.height);
placeVob(c, v, skewedcs, brBefore, brAfter, offs, context, scale);
}
Index: gzz/gzz/view/VobVanishingClient.java
diff -c gzz/gzz/view/VobVanishingClient.java:1.5
gzz/gzz/view/VobVanishingClient.java:1.6
*** gzz/gzz/view/VobVanishingClient.java:1.5 Thu Aug 29 06:08:34 2002
--- gzz/gzz/view/VobVanishingClient.java Wed Sep 25 10:45:43 2002
***************
*** 165,177 ****
public void place(Cell c, Object o, float fract, int x0, int y0, int x1,
int y1,
int depth, float rot) {
Vob v = (Vob)o;
! int cs = into.coords.coordsys(intoCS, c, depth, x0, y0, x1-x0, y1-y0);
cvf.addCellVobs(c, into, cs, v, context, fract);
}
public void connect(Cell cell1, Cell cell2, int dx, int dy) {
! int cs1 = into.coords.getCoordsys(cell1);
! int cs2 = into.coords.getCoordsys(cell2);
if(cs2 < 0)
into.map.put(pstubs[dx], cs1);
--- 165,177 ----
public void place(Cell c, Object o, float fract, int x0, int y0, int x1,
int y1,
int depth, float rot) {
Vob v = (Vob)o;
! int cs = into.coordsys(intoCS, c, depth, x0, y0, x1-x0, y1-y0);
cvf.addCellVobs(c, into, cs, v, context, fract);
}
public void connect(Cell cell1, Cell cell2, int dx, int dy) {
! int cs1 = into.matcher.getCS(cell1);
! int cs2 = into.matcher.getCS(cell2);
if(cs2 < 0)
into.map.put(pstubs[dx], cs1);
Index: gzz/gzz/vob/AffineVobCoorder.java
diff -c gzz/gzz/vob/AffineVobCoorder.java:1.7
gzz/gzz/vob/AffineVobCoorder.java:1.8
*** gzz/gzz/vob/AffineVobCoorder.java:1.7 Thu Aug 22 07:58:52 2002
--- gzz/gzz/vob/AffineVobCoorder.java Wed Sep 25 10:45:43 2002
***************
*** 26,54 ****
*/
public abstract class AffineVobCoorder implements VobCoorder {
! /** Create a new coordinate system.
*/
! public int coordsys(int into, Object key, float depth,
float x, float y, float w, float h) {
! return affineCoordsys(into, key, depth, x+w/2.0f, y+h/2.0f,
w/2.0f, 0, 0, h/2.0f);
}
! public int coordsys(Object key, float depth,
! float x, float y, float w, float h) {
! return coordsys(0, key, depth, x, y, w, h);
! }
!
!
! public abstract int affineCoordsys(int into, Object key, float depth,
float x, float y,
float xx, float xy, float yx, float yy);
- public int affineCoordsys(Object key, float depth,
- float x, float y,
- float xx, float xy, float yx, float yy) {
- return affineCoordsys(0, key, depth, x, y, xx, xy, yx, yy);
- }
}
--- 26,43 ----
*/
public abstract class AffineVobCoorder implements VobCoorder {
! /** Default implementation using affineCoordsys.
*/
! public int coordsys(int into, float depth,
float x, float y, float w, float h) {
! return affineCoordsys(into, depth, x+w/2.0f, y+h/2.0f,
w/2.0f, 0, 0, h/2.0f);
}
! public abstract int affineCoordsys(int into, float depth,
float x, float y,
float xx, float xy, float yx, float yy);
}
Index: gzz/gzz/vob/HBroken.java
diff -c gzz/gzz/vob/HBroken.java:1.3 gzz/gzz/vob/HBroken.java:1.4
*** gzz/gzz/vob/HBroken.java:1.3 Sat Sep 21 19:00:38 2002
--- gzz/gzz/vob/HBroken.java Wed Sep 25 10:45:43 2002
***************
*** 75,81 ****
float h = box.getHeight(scale) + box.getDepth(scale);
Object key = box.getKey();
! int cs = vs.coords.coordsys(coordsys, key, 0, x, y, w, h);
box.place(vs, cs, scale);
x += w;
--- 75,81 ----
float h = box.getHeight(scale) + box.getDepth(scale);
Object key = box.getKey();
! int cs = vs.coordsys(coordsys, key, 0, x, y, w, h);
box.place(vs, cs, scale);
x += w;
Index: gzz/gzz/vob/LinebreakingUtil.java
diff -c gzz/gzz/vob/LinebreakingUtil.java:1.5
gzz/gzz/vob/LinebreakingUtil.java:1.6
*** gzz/gzz/vob/LinebreakingUtil.java:1.5 Sat Sep 21 12:53:34 2002
--- gzz/gzz/vob/LinebreakingUtil.java Wed Sep 25 10:45:43 2002
***************
*** 27,33 ****
*/
public class LinebreakingUtil {
! String rcsid = "$Id: LinebreakingUtil.java,v 1.5 2002/09/21 16:53:34 benja
Exp $";
public static final int GLUE_LENGTH = 0;
public static final int GLUE_STRETCH = 1;
--- 27,33 ----
*/
public class LinebreakingUtil {
! String rcsid = "$Id: LinebreakingUtil.java,v 1.6 2002/09/25 14:45:43 tjl Exp
$";
public static final int GLUE_LENGTH = 0;
public static final int GLUE_STRETCH = 1;
***************
*** 116,122 ****
curwid = (int)dw;
over = dw - curwid;
! int boxcs = into.coords.coordsys(cs, boxes[i].getKey(), d,
x + wid, y - curhei, curwid, curhei + curdep);
boxes[i].place(into, boxcs, scale);
--- 116,122 ----
curwid = (int)dw;
over = dw - curwid;
! int boxcs = into.coordsys(cs, boxes[i].getKey(), d,
x + wid, y - curhei, curwid, curhei + curdep);
boxes[i].place(into, boxcs, scale);
Index: gzz/gzz/vob/OrthoCoorder.java
diff -c gzz/gzz/vob/OrthoCoorder.java:1.31 gzz/gzz/vob/OrthoCoorder.java:1.32
*** gzz/gzz/vob/OrthoCoorder.java:1.31 Wed Sep 4 18:15:39 2002
--- gzz/gzz/vob/OrthoCoorder.java Wed Sep 25 10:45:43 2002
***************
*** 28,34 ****
*/
public class OrthoCoorder implements VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.31 2002/09/04
22:15:39 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 28,34 ----
*/
public class OrthoCoorder implements VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.32 2002/09/25
14:45:43 tjl Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 102,116 ****
OrthoCoordsys sys;
float maxdepth = 0;
! public int getCoordsys(Object key) {
! // gets only toplevel so far
! return sys.map.get(0, key);
! }
!
! public int coordsys(int into, Object key, float depth, float x, float y,
float w, float h) {
if(maxdepth < depth) maxdepth = depth;
! return sys.add(into, key, depth, x, y, w, h);
}
/** Remove all rectangles (except root rect);
--- 102,111 ----
OrthoCoordsys sys;
float maxdepth = 0;
! public int coordsys(int into, float depth, float x, float y,
float w, float h) {
if(maxdepth < depth) maxdepth = depth;
! return sys.add(into, depth, x, y, w, h);
}
/** Remove all rectangles (except root rect);
***************
*** 137,165 ****
return getCSAt(x, y, null);
}
! public Object getKeyAt(VobMap v, float x, float y, float[]
internalcoords) {
! int cs = getCSAt(x, y, internalcoords);
! return sys.key[cs];
! }
!
! public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo,
float fract, java.awt.Graphics g, Color fg) {
! renderVobs(map, interpTo, fract, g, fg, 0, 0, 1, 1);
! }
!
! /** Get the CS matching a CS from another OrthoCoorder. */
! int getMatchingCS(OrthoCoordsys osys, int ocs) {
! if(ocs == 0)
! return 0;
!
! int my_parent = getMatchingCS(osys, osys.parent[ocs]);
! if(my_parent < 0) return -1;
! return sys.map.get(my_parent, osys.key[ocs]);
}
/** Render the vobs, fract towards the interpTo coordinates.
*/
! public void renderVobs(final DefaultVobMap map, final OrthoCoorder
interpTo,
final float fract, java.awt.Graphics g, Color fg,
final float xoffs,
final float yoffs,
--- 132,145 ----
return getCSAt(x, y, null);
}
! public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo, int[]
interpList,
float fract, java.awt.Graphics g, Color fg) {
! renderVobs(map, interpTo, interpList, fract, g, fg, 0, 0, 1, 1);
}
/** Render the vobs, fract towards the interpTo coordinates.
*/
! public void renderVobs(final DefaultVobMap map, final OrthoCoorder
interpTo, final int[] interpList,
final float fract, java.awt.Graphics g, Color fg,
final float xoffs,
final float yoffs,
***************
*** 184,191 ****
DefaultVobMap.RenderInfoSetter setter = new
DefaultVobMap.RenderInfoSetter() {
public boolean set(Vob.RenderInfo info, int my) {
int other = -1;
! if(interpTo != null && sys.map.canInterpolate &&
! interpTo.sys.map.canInterpolate) {
p("...interpTo != null");
if(my == 0) {
p("...my == 0.");
--- 164,170 ----
DefaultVobMap.RenderInfoSetter setter = new
DefaultVobMap.RenderInfoSetter() {
public boolean set(Vob.RenderInfo info, int my) {
int other = -1;
! if(interpTo != null) {
p("...interpTo != null");
if(my == 0) {
p("...my == 0.");
***************
*** 195,212 ****
return true;
}
! if(sys.key[my] == null) {
! p("...my.key == null.");
! return false;
! }
!
! other = interpTo.getMatchingCS(sys, my);
! if(other < 0) {
! p("No corresponding key in "+interpTo+" found for "+
! sys.key[my]+" in "+OrthoCoorder.this);
! return false;
! }
!
setInterpInfo(my, interpTo, other, fract,
xoffs, yoffs, xscale, yscale,
(OrthoRenderInfo)info);
--- 174,180 ----
return true;
}
! other = interpList[my];
setInterpInfo(my, interpTo, other, fract,
xoffs, yoffs, xscale, yscale,
(OrthoRenderInfo)info);
***************
*** 225,243 ****
for(int i=nsorted-1; i>=0; i--) {
p("...set: "+sorted[i]);
if(setter.set(info, sorted[i])) {
! p("...render: "+sorted[i]+" "+sys.key[sorted[i]]);
map.renderCS(sorted[i], info, g, setter, info2);
}
}
p("End rendervobs "+xoffs+" "+yoffs);
}
! public boolean needInterp(VobCoorder interpTo0) {
OrthoCoorder interpTo = (OrthoCoorder)interpTo0;
- if(!sys.map.canInterpolate || !interpTo.sys.map.canInterpolate)
- return false;
for(int my=1; my<sys.nsys; my++) {
! int other = interpTo.getMatchingCS(this.sys, my);
if(other > 0)
if(needInterp(my, interpTo, other)) return true;
}
--- 193,209 ----
for(int i=nsorted-1; i>=0; i--) {
p("...set: "+sorted[i]);
if(setter.set(info, sorted[i])) {
! p("...render: "+sorted[i]);
map.renderCS(sorted[i], info, g, setter, info2);
}
}
p("End rendervobs "+xoffs+" "+yoffs);
}
! public boolean needInterp(VobCoorder interpTo0, int[] interpList) {
OrthoCoorder interpTo = (OrthoCoorder)interpTo0;
for(int my=1; my<sys.nsys; my++) {
! int other = interpList[my];
if(other > 0)
if(needInterp(my, interpTo, other)) return true;
}
***************
*** 259,265 ****
sys.sorter.sort();
pa("Depth sorted:");
for(int i=sys.sorter.nsorted-1; i>=0; i--)
! pa(" "+sys.sorter.sorted[i]+" "+sys.key[sys.sorter.sorted[i]]);
}
}
--- 225,231 ----
sys.sorter.sort();
pa("Depth sorted:");
for(int i=sys.sorter.nsorted-1; i>=0; i--)
! pa(" "+sys.sorter.sorted[i]);
}
}
Index: gzz/gzz/vob/OrthoCoordsys.java
diff -c gzz/gzz/vob/OrthoCoordsys.java:1.4 gzz/gzz/vob/OrthoCoordsys.java:1.5
*** gzz/gzz/vob/OrthoCoordsys.java:1.4 Wed Aug 21 10:50:28 2002
--- gzz/gzz/vob/OrthoCoordsys.java Wed Sep 25 10:45:43 2002
***************
*** 22,31 ****
*/
package gzz.vob;
class OrthoCoordsys {
- OrthoCoordsysMap map;
OrthoDepthSorter sorter;
- Object[] key;
float[] depth, x, y, w, h;
int[] parent;
int[] nancestors;
--- 22,29 ----
***************
*** 39,48 ****
}
OrthoCoordsys(float mw, float mh, int initialSize) {
- map = new OrthoCoordsysMap(this, initialSize);
sorter = new OrthoDepthSorter(this, initialSize);
- key = new Object[initialSize];
depth = new float[initialSize];
x = new float[initialSize];
y = new float[initialSize];
--- 37,44 ----
***************
*** 56,74 ****
}
void clear(float mw, float mh) {
! key[0] = null; depth[0] = 0;
x[0] = 0; y[0] = 0; w[0] = mw; h[0] = mh;
parent[0] = -1; nancestors[0] = 0;
nsys = 1;
! map.clear(); sorter.clear();
}
! int add(int mparent, Object mkey, float mdepth, float mx, float my,
float mw, float mh) {
int cs = next();
- key[cs] = mkey;
w[cs] = mw;
h[cs] = mh;
--- 52,69 ----
}
void clear(float mw, float mh) {
! depth[0] = 0;
x[0] = 0; y[0] = 0; w[0] = mw; h[0] = mh;
parent[0] = -1; nancestors[0] = 0;
nsys = 1;
! sorter.clear();
}
! int add(int mparent, float mdepth, float mx, float my,
float mw, float mh) {
int cs = next();
w[cs] = mw;
h[cs] = mh;
***************
*** 83,99 ****
nextHashtableEntry[cs] = 0;
- map.add(cs);
return cs;
}
protected int next() {
int n = nsys;
nsys++;
! if(nsys > key.length) {
! int o = key.length, l = key.length * 2;
- Object[] nkey = new Object[l];
float[] ndepth = new float[l];
float[] nx = new float[l];
float[] ny = new float[l];
--- 78,92 ----
nextHashtableEntry[cs] = 0;
return cs;
}
protected int next() {
int n = nsys;
nsys++;
! if(nsys > depth.length) {
! int o = depth.length, l = depth.length * 2;
float[] ndepth = new float[l];
float[] nx = new float[l];
float[] ny = new float[l];
***************
*** 103,109 ****
int[] nnancestors = new int[l];
int[] nnext = new int[l];
- System.arraycopy(key, 0, nkey, 0, o);
System.arraycopy(depth, 0, ndepth, 0, o);
System.arraycopy(x, 0, nx, 0, o);
System.arraycopy(y, 0, ny, 0, o);
--- 96,101 ----
***************
*** 113,119 ****
System.arraycopy(nancestors, 0, nnancestors, 0, o);
System.arraycopy(nextHashtableEntry, 0, nnext, 0, o);
! key = nkey; depth = ndepth;
x = nx; y = ny; w = nw; h = nh;
parent = nparent;
nancestors = nnancestors;
--- 105,111 ----
System.arraycopy(nancestors, 0, nnancestors, 0, o);
System.arraycopy(nextHashtableEntry, 0, nnext, 0, o);
! depth = ndepth;
x = nx; y = ny; w = nw; h = nh;
parent = nparent;
nancestors = nnancestors;
Index: gzz/gzz/vob/OrthoCoordsysMap.java
diff -c gzz/gzz/vob/OrthoCoordsysMap.java:1.5
gzz/gzz/vob/OrthoCoordsysMap.java:1.6
*** gzz/gzz/vob/OrthoCoordsysMap.java:1.5 Thu Aug 22 13:26:57 2002
--- gzz/gzz/vob/OrthoCoordsysMap.java Wed Sep 25 10:45:43 2002
***************
*** 22,78 ****
*/
package gzz.vob;
class OrthoCoordsysMap {
- OrthoCoordsys sys;
- int[] hashtable;
- boolean canInterpolate;
-
- OrthoCoordsysMap(OrthoCoordsys sys, int initialSize) {
- this.sys = sys;
- hashtable = new int[initialSize];
- canInterpolate = true;
- }
-
- void clear() {
- for(int i=0; i<hashtable.length; i++)
- hashtable[i] = 0;
- canInterpolate = true;
- }
-
- final int hash(int cs) {
- return Math.abs(sys.key[cs].hashCode()) ^ sys.parent[cs];
- }
-
- void add(int cs) {
- if(sys.key[cs] == null) return;
- if(get(sys.parent[cs], sys.key[cs]) >= 0) {
- canInterpolate = false; return;
- }
-
- if(sys.nsys > hashtable.length) { rehash(); return; }
-
- int i = hash(cs) % hashtable.length;
- sys.nextHashtableEntry[cs] = hashtable[i];
- hashtable[i] = cs;
- }
-
- int get(int parent, Object key) {
- if(key == null) return -1;
- int hash = Math.abs(key.hashCode()) ^ parent;
- int i = hash % hashtable.length;
- int cs = hashtable[i];
- while(cs > 0) {
- if(parent == sys.parent[cs])
- if(key.equals(sys.key[cs]))
- return cs;
-
- cs = sys.nextHashtableEntry[cs];
- }
- return -1;
- }
-
- void rehash() {
- hashtable = new int[sys.nsys * 2];
- for(int i=1; i<sys.nsys; i++)
- add(i);
- }
}
--- 22,25 ----
Index: gzz/gzz/vob/OrthoDepthSorter.java
diff -c gzz/gzz/vob/OrthoDepthSorter.java:1.3
gzz/gzz/vob/OrthoDepthSorter.java:1.4
*** gzz/gzz/vob/OrthoDepthSorter.java:1.3 Sun Aug 18 19:09:08 2002
--- gzz/gzz/vob/OrthoDepthSorter.java Wed Sep 25 10:45:43 2002
***************
*** 44,51 ****
void sort() {
if(nsorted < sys.nsys) {
if(sorted.length < sys.nsys) {
! sorted = new int[sys.key.length];
! helper = new int[sys.key.length];
}
for(int i=nsorted; i<sys.nsys; i++)
--- 44,51 ----
void sort() {
if(nsorted < sys.nsys) {
if(sorted.length < sys.nsys) {
! sorted = new int[sys.depth.length];
! helper = new int[sys.depth.length];
}
for(int i=nsorted; i<sys.nsys; i++)
Index: gzz/gzz/vob/VobCoorder.java
diff -c gzz/gzz/vob/VobCoorder.java:1.12 gzz/gzz/vob/VobCoorder.java:1.13
*** gzz/gzz/vob/VobCoorder.java:1.12 Thu Aug 15 12:37:11 2002
--- gzz/gzz/vob/VobCoorder.java Wed Sep 25 10:45:43 2002
***************
*** 32,43 ****
* represents the root coordinate system (i.e., the whole vob scene).
*/
public interface VobCoorder {
- /** Get the index of the coordinate system for the given key.
- * @param inside The coordinate system to search inside
- * (<code>0</code> for the root coordinate system).
- */
- int getCoordsys(Object key);
-
/** Create a new coordinate system.
* @param key The key that identifies this coordinate system.
* The key is used for interpolation
--- 32,37 ----
***************
*** 45,65 ****
* system into, <code>0</code> for the root
* coordinate system.
*/
! int coordsys(int into, Object key, float depth, float x, float y,
! float w, float h);
!
! /** Get the key of the object at given coordinates.
! * @param x,y The coordinates
! * @param internalcoords (output) the coordinates (-1..1) relative
! * to the vob
! */
! Object getKeyAt(VobMap v, float x, float y, float[] internalcoords);
int getCSIndexAt(float x, float y);
! boolean needInterp(VobCoorder interpTo);
Vob.RenderInfo getRenderInfo(int csind);
void dump();
}
--- 39,52 ----
* system into, <code>0</code> for the root
* coordinate system.
*/
! int coordsys(int into, float depth, float x, float y, float w, float h);
int getCSIndexAt(float x, float y);
! boolean needInterp(VobCoorder interpTo, int[] interpList);
Vob.RenderInfo getRenderInfo(int csind);
+
void dump();
}
Index: gzz/gzz/vob/VobScene.java
diff -c gzz/gzz/vob/VobScene.java:1.10 gzz/gzz/vob/VobScene.java:1.11
*** gzz/gzz/vob/VobScene.java:1.10 Thu Aug 29 05:41:16 2002
--- gzz/gzz/vob/VobScene.java Wed Sep 25 10:45:43 2002
***************
*** 41,58 ****
public class VobScene {
public final VobMap map;
public final VobCoorder coords;
public final gzz.client.GraphicsAPI gfxapi;
public final gzz.client.GraphicsAPI.Window window;
public final Dimension size;
! public VobScene(VobMap m, VobCoorder c,
gzz.client.GraphicsAPI gfxapi,
gzz.client.GraphicsAPI.Window window,
Dimension size) {
this.map = m;
this.coords = c;
this.gfxapi = gfxapi;
this.window = window;
this.size = size;
--- 41,60 ----
public class VobScene {
public final VobMap map;
public final VobCoorder coords;
+ public final VobMatcher matcher;
public final gzz.client.GraphicsAPI gfxapi;
public final gzz.client.GraphicsAPI.Window window;
public final Dimension size;
! public VobScene(VobMap m, VobCoorder c, VobMatcher mat,
gzz.client.GraphicsAPI gfxapi,
gzz.client.GraphicsAPI.Window window,
Dimension size) {
this.map = m;
this.coords = c;
+ this.matcher = mat;
this.gfxapi = gfxapi;
this.window = window;
this.size = size;
***************
*** 72,79 ****
put(v, null, d, x, y, w, h);
}
public void put(Vob v, Object key, float d, float x, float y, float w,
float h) {
! int c = coords.coordsys(0, key, d, x, y, w, h);
map.put(v, c);
}
public void dump() {
--- 74,93 ----
put(v, null, d, x, y, w, h);
}
public void put(Vob v, Object key, float d, float x, float y, float w,
float h) {
! int c = coords.coordsys(0, d, x, y, w, h);
! if(key != null)
! matcher.add(c, key);
map.put(v, c);
+ }
+
+ public int coordsys(int into, Object key, float d, float x, float y,
float w, float h) {
+ int cs = coords.coordsys(into, d, x, y, w, h);
+ matcher.addSub(into, cs, key);
+ return cs;
+ }
+
+ public Object getKeyAt(float x, float y, float[] targetcoords) {
+ return null;
}
public void dump() {
Index: gzz/test/gzz/vob/TestLBChain.java
diff -c gzz/test/gzz/vob/TestLBChain.java:1.11
gzz/test/gzz/vob/TestLBChain.java:1.12
*** gzz/test/gzz/vob/TestLBChain.java:1.11 Sat Sep 21 09:04:56 2002
--- gzz/test/gzz/vob/TestLBChain.java Wed Sep 25 10:45:43 2002
***************
*** 29,35 ****
*/
public class TestLBChain extends TestCase {
! String rcsid = "$Id: TestLBChain.java,v 1.11 2002/09/21 13:04:56 benja Exp $";
public TestLBChain(String s) { super(s); }
--- 29,35 ----
*/
public class TestLBChain extends TestCase {
! String rcsid = "$Id: TestLBChain.java,v 1.12 2002/09/25 14:45:43 tjl Exp $";
public TestLBChain(String s) { super(s); }
***************
*** 59,64 ****
--- 59,65 ----
VobScene sc = new VobScene(new DefaultVobMap(),
new OrthoCoorder(1000,1000),
+ new DefaultVobMatcher(),
null,
null,
new Dimension(1000,1000));
Index: gzz/test/gzz/vob/TestVobScene.java
diff -c gzz/test/gzz/vob/TestVobScene.java:1.11
gzz/test/gzz/vob/TestVobScene.java:1.12
*** gzz/test/gzz/vob/TestVobScene.java:1.11 Wed Sep 25 06:56:54 2002
--- gzz/test/gzz/vob/TestVobScene.java Wed Sep 25 10:45:43 2002
***************
*** 29,35 ****
*/
abstract public class TestVobScene extends TestCase {
! String rcsid = "$Id: TestVobScene.java,v 1.11 2002/09/25 10:56:54 benja Exp
$";
static boolean dbg = false;
public TestVobScene(String s) { super(s); }
--- 29,35 ----
*/
abstract public class TestVobScene extends TestCase {
! String rcsid = "$Id: TestVobScene.java,v 1.12 2002/09/25 14:45:43 tjl Exp $";
static boolean dbg = false;
public TestVobScene(String s) { super(s); }
***************
*** 51,59 ****
Vob vob = new gzz.vob.DummyVob();
vs.put(vob, "v0", 7, 100, 100, 20, 20);
! assertEquals(null, vs.coords.getKeyAt(vs.map, 5, 5, null));
vs.put(vob, "v1", 13, 100, 100, 20, 20);
! assertEquals(null, vs.coords.getKeyAt(vs.map, 5, 5, null));
if(dbg) vs.dump();
--- 51,59 ----
Vob vob = new gzz.vob.DummyVob();
vs.put(vob, "v0", 7, 100, 100, 20, 20);
! assertEquals(null, vs.getKeyAt(5, 5, null));
vs.put(vob, "v1", 13, 100, 100, 20, 20);
! assertEquals(null, vs.getKeyAt(5, 5, null));
if(dbg) vs.dump();
***************
*** 62,91 ****
if(dbg) vs.dump();
! assertEquals("va", vs.coords.getKeyAt(vs.map, 5, 5, null));
vs.put(vob, "vb", 8, 5, 5, 15, 15);
! assertEquals("vb", vs.coords.getKeyAt(vs.map, 5, 5, null));
vs.put(vob, "vc", 6, 0, 0, 30, 30);
! assertEquals("vc", vs.coords.getKeyAt(vs.map, 5, 5, null));
vs.put(vob, "vd", 4, 0, 0, 30, 30);
! assertEquals("vd", vs.coords.getKeyAt(vs.map, 5, 5, null));
// ...except here.
vs.put(vob, "ve", 5, 0, 0, 30, 30);
if(dbg) vs.dump();
! assertEquals("vd", vs.coords.getKeyAt(vs.map, 5, 5, null));
vs.put(vob, "vf", -5, 0, 0, 30, 30);
! assertEquals("vf", vs.coords.getKeyAt(vs.map, 5, 5, null));
// ...and here.
vs.put(vob, "vg", 20, 0, 0, 30, 30);
! assertEquals("vf", vs.coords.getKeyAt(vs.map, 5, 5, null));
}
public void testGetVob() {
--- 62,91 ----
if(dbg) vs.dump();
! assertEquals("va", vs.getKeyAt(5, 5, null));
vs.put(vob, "vb", 8, 5, 5, 15, 15);
! assertEquals("vb", vs.getKeyAt(5, 5, null));
vs.put(vob, "vc", 6, 0, 0, 30, 30);
! assertEquals("vc", vs.getKeyAt(5, 5, null));
vs.put(vob, "vd", 4, 0, 0, 30, 30);
! assertEquals("vd", vs.getKeyAt(5, 5, null));
// ...except here.
vs.put(vob, "ve", 5, 0, 0, 30, 30);
if(dbg) vs.dump();
! assertEquals("vd", vs.getKeyAt(5, 5, null));
vs.put(vob, "vf", -5, 0, 0, 30, 30);
! assertEquals("vf", vs.getKeyAt(5, 5, null));
// ...and here.
vs.put(vob, "vg", 20, 0, 0, 30, 30);
! assertEquals("vf", vs.getKeyAt(5, 5, null));
}
public void testGetVob() {
***************
*** 105,112 ****
}
public void testGetRenderinfo() {
! VobCoorder coorder = createVobScene().coords;
! int cs = coorder.coordsys(0, "1", 10, 20, 30, 40, 50);
Vob.RenderInfo info = coorder.getRenderInfo(cs);
assertNotNull(info);
--- 105,113 ----
}
public void testGetRenderinfo() {
! VobScene scene = createVobScene();
! VobCoorder coorder = scene.coords;
! int cs = scene.coordsys(0, "1", 10, 20, 30, 40, 50);
Vob.RenderInfo info = coorder.getRenderInfo(cs);
assertNotNull(info);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gfx/librenderables/Re...,
Tuomas J. Lukka <=