[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/librenderables/renderables.py gfx/libre...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] gzz gfx/librenderables/renderables.py gfx/libre... |
Date: |
Wed, 02 Oct 2002 07:43:45 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Asko Soukka <address@hidden> 02/10/02 07:43:44
Modified files:
gfx/librenderables: renderables.py Renderables.hxx
gfx/jni : GzzGL-jni.cxx
gzz/gfx/gl : GL.java GLVobMap.java
Added files:
gzz/vob : Vob3.java
Log message:
renderable3
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobMap.java.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/Vob3.java?rev=1.1
Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -c gzz/gfx/jni/GzzGL-jni.cxx:1.41 gzz/gfx/jni/GzzGL-jni.cxx:1.42
*** gzz/gfx/jni/GzzGL-jni.cxx:1.41 Tue Oct 1 07:44:29 2002
--- gzz/gfx/jni/GzzGL-jni.cxx Wed Oct 2 07:43:44 2002
***************
*** 28,33 ****
--- 28,34 ----
using Renderables::Renderable0;
using Renderables::Renderable1;
using Renderables::Renderable2;
+ using Renderables::Renderable3;
using Renderables::TextRenderer;
***************
*** 50,55 ****
--- 51,57 ----
ObjectStorer<Renderable0> renderable0s;
ObjectStorer<Renderable1> renderable1s;
ObjectStorer<Renderable2> renderable2s;
+ ObjectStorer<Renderable3> renderable3s;
ObjectStorer<ByteVector> bytevectors;
extern ObjectStorer<Paper::Paper> papers;
***************
*** 806,811 ****
--- 808,818 ----
(JNIEnv *, jclass, jint id) {
renderable2s.remove(id);
}
+
+ JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable3
+ (JNIEnv *, jclass, jint id) {
+ renderable3s.remove(id);
+ }
// functions
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_startContext
***************
*** 892,898 ****
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";
--- 899,905 ----
GLERR
DBG(dbg) << "Did stdcoords\n";
! renderer.renderScene((int *)codes, renderable0s, renderable1s,
renderable2s, renderable3s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
***************
*** 965,971 ****
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";
--- 972,978 ----
double t0 = getTime();
for (int i = 0; i < iters; i++) {
! renderer.renderScene((int *)codes, renderable0s, renderable1s,
renderable2s, renderable3s);
DBG(dbg) << "Did renderscene\n";
windows.get(window)->swapBuffers();
DBG(dbg) << "Did swapbuffers\n";
***************
*** 1111,1113 ****
--- 1118,1128 ----
#include "librenderables/RealRenderables-jni.hxx"
}
+
+
+
+
+
+
+
+
Index: gzz/gfx/librenderables/Renderables.hxx
diff -c gzz/gfx/librenderables/Renderables.hxx:1.17
gzz/gfx/librenderables/Renderables.hxx:1.18
*** gzz/gfx/librenderables/Renderables.hxx:1.17 Tue Oct 1 13:05:32 2002
--- gzz/gfx/librenderables/Renderables.hxx Wed Oct 2 07:43:44 2002
***************
*** 93,98 ****
--- 93,99 ----
const int RENDERABLE0 = 0x0800000;
const int RENDERABLE1 = 0x1000000;
const int RENDERABLE2 = 0x2000000;
+ const int RENDERABLE3 = 0x3000000;
const int RMASK = 0xf800000;
class ShaderRect {
***************
*** 144,149 ****
--- 145,165 ----
virtual void render(Coords::CoordSys &c1, Coords::CoordSys &c2) \
{ renderImpl(c1, c2); } \
+ /** An OpenGL thing which starts in one coordinate
+ * system and ends in another. Used for connections.
+ * The third coordinate system is used for leaving
+ * unnecessary stuff without rendering.
+ */
+ struct Renderable3 {
+ virtual ~Renderable3() { }
+ virtual void render(Coords::CoordSys &c1, Coords::CoordSys &c2,
+ Coords::CoordSys &c3) = 0;
+ };
+
+ #define IMPLEMENTRENDER3 \
+ virtual void render(Coords::CoordSys &c1, Coords::CoordSys &c2, \
+ Coords::CoordSys &c3) \
+ { renderImpl(c1, c2, c3); } \
using std::vector;
***************
*** 151,156 ****
--- 167,173 ----
class Renderer {
Coords::CoordSet coordset;
public:
+ // TODO: RENDERABLE3 setPoints()
void setPoints( int ninds,
int *inds1, float *points1,
int *interpinds,
***************
*** 167,192 ****
void renderScene(int *codes,
ObjectStorer<Renderable0> &r0s,
ObjectStorer<Renderable1> &r1s,
! ObjectStorer<Renderable2> &r2s) {
int i=0;
if(dbg) std::cout << "renderScene\n";
while(codes[i] != 0) {
if(dbg) std::cout << "Rendercode "<<i<<" "<<codes[i]<<"\n";
// cout << "Code: "<<codes[i]<<"\n";
int code = codes[i] & ~RMASK;
! if(codes[i] & RENDERABLE0) {
if(dbg) std::cout << "rend0 "<<r0s[code]<<"\n";
r0s[code]->render();
i += 1;
}
! else if(codes[i] & RENDERABLE1) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
if(dbg) std::cout << "rend1 "<<r1s[code]<<":
"<<codes[i+1]<<" "<<cs1<<"\n";
if(cs1)
r1s[code]->render(*cs1);
i += 2;
}
! else if(codes[i] & RENDERABLE2) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
if(dbg) std::cout << "rend2 "<<r2s[code]<<": "
--- 184,210 ----
void renderScene(int *codes,
ObjectStorer<Renderable0> &r0s,
ObjectStorer<Renderable1> &r1s,
! ObjectStorer<Renderable2> &r2s,
! ObjectStorer<Renderable3> &r3s) {
int i=0;
if(dbg) std::cout << "renderScene\n";
while(codes[i] != 0) {
if(dbg) std::cout << "Rendercode "<<i<<" "<<codes[i]<<"\n";
// cout << "Code: "<<codes[i]<<"\n";
int code = codes[i] & ~RMASK;
! if((codes[i] & RMASK) == RENDERABLE0) {
if(dbg) std::cout << "rend0 "<<r0s[code]<<"\n";
r0s[code]->render();
i += 1;
}
! else if((codes[i] & RMASK) == RENDERABLE1) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
if(dbg) std::cout << "rend1 "<<r1s[code]<<":
"<<codes[i+1]<<" "<<cs1<<"\n";
if(cs1)
r1s[code]->render(*cs1);
i += 2;
}
! else if((codes[i] & RMASK) == RENDERABLE2) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
if(dbg) std::cout << "rend2 "<<r2s[code]<<": "
***************
*** 195,200 ****
--- 213,229 ----
r2s[code]->render(*cs1, *cs2);
i += 3;
}
+ else if((codes[i] & RMASK) == RENDERABLE3) {
+ Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
+ Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
+ Coords::CoordSys *cs3 = coordset.get(codes[i+3]);
+ if(dbg) std::cout << "rend3 "<<r3s[code]<<": "
+ <<codes[i+1]<<" "<<cs1<<"
"<<codes[i+2]<<" "<<cs2<<" "
+ <<cs3<<" "<<codes[i+3]<<"\n";
+ if(cs1 && cs2 && cs3)
+ r3s[code]->render(*cs1, *cs2, *cs3);
+ i += 4;
+ }
else {
// We have a problem
cout << "HELP!\n";
***************
*** 207,211 ****
--- 236,262 ----
}
};
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.92
gzz/gfx/librenderables/renderables.py:1.93
*** gzz/gfx/librenderables/renderables.py:1.92 Tue Oct 1 15:12:46 2002
--- gzz/gfx/librenderables/renderables.py Wed Oct 2 07:43:44 2002
***************
*** 1102,1108 ****
(ExtraClass or "")+ "\n\n"
)
! if Type == "2" :
headercode += "template<class Coords> void renderImpl(Coords &coords1,
Coords &coords2)"
elif Type == "1" :
headercode += "template<class Coords> void renderImpl(Coords &coords1)"
--- 1102,1110 ----
(ExtraClass or "")+ "\n\n"
)
! if Type == "3" :
! headercode += "template<class Coords> void renderImpl(Coords &coords1,
Coords &coords2, Coords &coords3)"
! elif Type == "2" :
headercode += "template<class Coords> void renderImpl(Coords &coords1,
Coords &coords2)"
elif Type == "1" :
headercode += "template<class Coords> void renderImpl(Coords &coords1)"
***************
*** 1161,1164 ****
--- 1163,1169 ----
open(jnifile, "w").write(jni);
+
+
+
Index: gzz/gzz/gfx/gl/GL.java
diff -c gzz/gzz/gfx/gl/GL.java:1.8 gzz/gzz/gfx/gl/GL.java:1.9
*** gzz/gzz/gfx/gl/GL.java:1.8 Mon Sep 30 18:20:28 2002
--- gzz/gzz/gfx/gl/GL.java Wed Oct 2 07:43:44 2002
***************
*** 85,90 ****
--- 85,93 ----
/** See RENDERABLE0.
*/
public static final int RENDERABLE2 = 0x2000000;
+ /** See RENDERABLE0.
+ */
+ public static final int RENDERABLE3 = 0x3000000;
/** The Java proxy for a C++ object.
*/
***************
*** 214,219 ****
--- 217,256 ----
}
static private native void deleteRenderable2(int id);
+ /** The Java proxy representing a Renderable2 object.
+ */
+ static public abstract class Renderable3JavaObject extends JavaObject
+ implements gzz.vob.Vob3 {
+ public Renderable3JavaObject(int id) { super(id); }
+ /** Add this object to the given list with the given coordinate
+ * systems.
+ * Usage:
+ * <pre>
+ * int[] list;
+ * int curs;
+ * curs = obj.addToList(list, curs, coordsys1, coordsys2,
coordsys3);
+ * </pre>
+ * @param list The display list to add this to.
+ * @param cur The current index, to which the first int goes
+ * @param coordsys1 The number of the first system.
+ * @param coordsys2 The number of the second system.
+ * @param coordsys3 The number of the third system.
+ * @return The new current index after adding these.
+ */
+ public int addToListGL(GraphicsAPI.Window win, int[] list, int cur,
+ int coordsys1, int coordsys2, int coordsys3) {
+ list[cur++] = (RENDERABLE3 | getId());
+ list[cur++] = coordsys1;
+ list[cur++] = coordsys2;
+ list[cur++] = coordsys3;
+ return cur;
+ }
+ protected void deleteObj() {
+ deleteRenderable3(getId());
+ }
+ }
+ static private native void deleteRenderable3(int id);
+
//--------- Window
/** An on-screen GLX window into which graphics can be drawn.
*/
***************
*** 648,650 ****
--- 685,689 ----
}
+
+
Index: gzz/gzz/gfx/gl/GLVobMap.java
diff -c gzz/gzz/gfx/gl/GLVobMap.java:1.12 gzz/gzz/gfx/gl/GLVobMap.java:1.13
*** gzz/gzz/gfx/gl/GLVobMap.java:1.12 Tue Sep 10 07:39:36 2002
--- gzz/gzz/gfx/gl/GLVobMap.java Wed Oct 2 07:43:44 2002
***************
*** 25,31 ****
import java.awt.*;
public class GLVobMap implements VobMap {
! public static final String rcsid = "$Id: GLVobMap.java,v 1.12 2002/09/10
11:39:36 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 25,31 ----
import java.awt.*;
public class GLVobMap implements VobMap {
! public static final String rcsid = "$Id: GLVobMap.java,v 1.13 2002/10/02
11:43:44 humppake Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 39,46 ****
int[] list = new int[10000];
int curs = 0;
int[] cs = new int[10000];
! Vob[] vobs = new Vob[10000];
int nvobs = 0;
public void put(Vob vob, int coordsys1, int coordsys2) {
curs = vob.addToListGL(screen, list, curs, coordsys1, coordsys2);
if(dbg) pa("Add to GLVobMap "+this+": "+vob+" "+coordsys1+"
"+coordsys2+" curs: "+curs);
--- 39,55 ----
int[] list = new int[10000];
int curs = 0;
int[] cs = new int[10000];
! Object[] vobs = new Vob[10000];
int nvobs = 0;
+ public void put(Vob3 vob, int coordsys1, int coordsys2, int coordsys3) {
+ curs = vob.addToListGL(screen, list, curs, coordsys1,
+ coordsys2, coordsys3);
+ if(dbg) pa("Add to GLVobMap "+this+": "+vob+" "+coordsys1+" "
+ +coordsys2+" "+coordsys3+" curs: "+curs);
+ // Stash it away so it won't get garbage collected too early :(
+ cs[nvobs] = coordsys1;
+ vobs[nvobs++] = vob;
+ }
public void put(Vob vob, int coordsys1, int coordsys2) {
curs = vob.addToListGL(screen, list, curs, coordsys1, coordsys2);
if(dbg) pa("Add to GLVobMap "+this+": "+vob+" "+coordsys1+"
"+coordsys2+" curs: "+curs);
***************
*** 68,74 ****
public Vob getVobByCS(int csind) {
for(int i=nvobs-1; i>=0; i--) {
if(cs[i] == csind)
! return vobs[i];
}
return null;
}
--- 77,83 ----
public Vob getVobByCS(int csind) {
for(int i=nvobs-1; i>=0; i--) {
if(cs[i] == csind)
! return (Vob)vobs[i];
}
return null;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gfx/librenderables/renderables.py gfx/libre...,
Asko Soukka <=