[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/li...
From: |
Matti Katila |
Subject: |
[Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/li... |
Date: |
Tue, 29 Apr 2003 20:33:56 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Matti Katila <address@hidden> 03/04/29 20:33:56
Modified files:
include/vob/jni: Types.hxx
include/vob/lines: Lines.hxx
org/nongnu/libvob/vobs: ContinuousLineVob.java
src/jni : Makefile Modules jnivobs.hxx
src/lines : Lines.cxx
src/texture : line.texture
Added files:
include/vob/vobs: Lines.hxx
src/jni : Lines.cxx
vob/demo : lines.py
Log message:
work for lines + added Types
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/lines/Lines.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Lines.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Lines.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Modules.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/jnivobs.hxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/lines/Lines.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/texture/line.texture.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/lines.py?rev=1.1
Patches:
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.21
libvob/include/vob/jni/Types.hxx:1.22
--- libvob/include/vob/jni/Types.hxx:1.21 Tue Apr 15 09:54:20 2003
+++ libvob/include/vob/jni/Types.hxx Tue Apr 29 20:33:56 2003
@@ -164,6 +164,7 @@
VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat)
VOB_JNI_CONVERSION_ASSIGN(int, "int", jint)
+ VOB_JNI_CONVERSION_ASSIGN(bool, "boolean", jboolean)
START_VOB_JNI_CONVERSION(Token, "String", jstring)
DBG(dbg_convert) << "Converting token "<<in<<"\n";
@@ -177,6 +178,10 @@
START_VOB_JNI_CONVERSION(std::string, "String", jstring)
out = jstr2stdstr(env, in);
+ END_VOB_JNI_CONVERSION
+
+ START_VOB_JNI_CONVERSION(float *, "float []", jfloatArray)
+ out = env->GetFloatArrayElements(in, 0);
END_VOB_JNI_CONVERSION
Index: libvob/include/vob/lines/Lines.hxx
diff -u libvob/include/vob/lines/Lines.hxx:1.1
libvob/include/vob/lines/Lines.hxx:1.2
--- libvob/include/vob/lines/Lines.hxx:1.1 Mon Apr 28 16:34:33 2003
+++ libvob/include/vob/lines/Lines.hxx Tue Apr 29 20:33:56 2003
@@ -28,17 +28,29 @@
class SimpleLine {
GLuint textureId;
float linewidth;
- bool has_not_inited;
-
- private:
- void init();
-
public:
- SimpleLine(GLuint textId, float l):
- textureId(textId), linewidth(l), has_not_inited(true) { }
+ SimpleLine(GLuint textId, float l, float * points, int size):
+ textureId(textId), linewidth(l)
+ {
+ if (textId <= 0) {
+ cout << "Error in SimpleLine - TextId under or zero!"<< textId
<<"\n";
+ return;
+ }
+ if (size != 6) {
+ cout << "Errorr in SimpleLine - not enough points!"<< size <<"\n";
+ return;
+ } else {
+
+ // You have to transform a and b before hand.
+ // XXX can z coord be zero?!
+ draw(ZPt( points[0],points[1], points[2]) ,
+ ZPt( points[3], points[4], points[5]) );
+ }
+
+ }
~SimpleLine() { }
+
/** Draws a line from point a to b.
- * You have to transform a and b before hand.
*/
void draw(ZPt a, ZPt b);
};
@@ -67,33 +79,35 @@
bool drawDone;
bool chain;
float lineWidth;
+ int joinStyle;
public:
/** ContinuousLine is line constructed from various points.
* It bends in given points.
+ * http://www.xaraxone.com/webxealot/xealot19/page_4.htm
*
- * @params textId texture's id - must be > 0.
- * @params cornerBehaviour "Bevel", "Miter" or "Round"
- * @lineWidth line's width
- * @chain join first and last point
- * @points float array of points a,b,c etc.
+ * @param textId texture's id - must be > 0.
+ * @param joinStyle "Bevel", "Miter" or "Round"
+ * @param lineWidth line's width
+ * @param chain join first and last point
+ * @param points float array of points a,b,c etc.
* { ax,ay,az, bx,by,bz, cx,cy,cz, etc.. }
- * @size size of points array
+ * @param size size of points array
*/
- ContinuousLine(GLuint textId, int cornerBehaviour,
- float lineWidth, bool chain,
+ ContinuousLine(GLuint textId, float lineWidth,
+ int joinStyle, bool chain,
float * points, int size);
/** ContinuousLine is line constructed from various points.
* It bends in given points.
- *
- * @params textId texture's id - must be > 0.
- * @params cornerBehaviour "Bevel", "Miter" or "Round"
- * @lineWidth line's width
- * @chain join first and last point
+ * http://www.xaraxone.com/webxealot/xealot19/page_4.htm
+ * @param textId texture's id - must be > 0.
+ * @param joinStyle "Bevel", "Miter" or "Round"
+ * @param lineWidth line's width
+ * @param chain join first and last point
*/
- ContinuousLine(GLuint textId, int cornerBehaviour,
- float lineWidth, bool chain);
+ ContinuousLine(GLuint textId, float lineWidth,
+ int joinStyle, bool chain);
~ContinuousLine();
/** Add the first point or
Index: libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java
diff -u libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java:1.1
libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java:1.2
--- libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java:1.1 Mon Apr 28
17:49:02 2003
+++ libvob/org/nongnu/libvob/vobs/ContinuousLineVob.java Tue Apr 29
20:33:56 2003
@@ -36,31 +36,48 @@
/** Continuous line needs x,y,z points in float array.
*/
public class ContinuousLineVob extends AbstractVob {
-public static final String rcsid = "$Id: ContinuousLineVob.java,v 1.1
2003/04/28 21:49:02 mudyc Exp $";
+public static final String rcsid = "$Id: ContinuousLineVob.java,v 1.2
2003/04/30 00:33:56 mudyc Exp $";
+ static private void pa(String s) {
System.out.println("ContinuousLine::"+s); }
static private GL.Texture tex;
static private boolean needInit = true;
static private void loadTex() {
- if (!needInit) {
+ if (needInit) {
String[] texparam = null;
tex = GL.createTexture();
- tex.shade_all_levels(256, 256, 0, 1, "ALPHA", "ALPHA", "line",
texparam);
+ pa("texture: "+tex);
+ //tex.shade_all_levels(256, 256, 0, 1, "ALPHA", "ALPHA", "line",
texparam);
+ tex.shade(128, 128, 0, 1, "ALPHA", "ALPHA", "line", texparam);
needInit = false;
}
}
- float width;
- float[] points;
- Color color;
+ private float width;
+ private float[] points;
+ private Color color;
+ private boolean chain;
+ private int joinStyle;
+
+ /** Bevel shape model of the bending with ContinuousLine
+ */
+ static public final int BEVEL = 100;
+ /** Miter shape model of the bending with ContinuousLine
+ */
+ static public final int MITER = 200;
+ /** Round shape model of the bending with ContinuousLine
+ */
+ static public final int ROUND = 300;
public ContinuousLineVob(float width, float[] points) {
- this(width, points, null);
+ this(width, points, false, BEVEL, null);
}
- public ContinuousLineVob(float width, float[] points, Color color) {
+ public ContinuousLineVob(float width, float[] points, boolean chain, int
joinStyle, Color color) {
super();
this.width = width;
this.points = points;
+ this.chain = chain;
+ this.joinStyle = joinStyle;
this.color = color;
}
@@ -91,13 +108,13 @@
public int putGL(VobScene vs, int coordsys1) {
if (needInit) loadTex();
- ColorUtil.getRGBColorComponents(color, tmp_floats);
+ if (color != null) ColorUtil.getRGBColorComponents(color, tmp_floats);
+
+ pa("tex:"+tex+", w:"+width+", jS:"+joinStyle+", chain:"+chain+",
points"+points);
- /*
GLRen.ContinuousLine cl =
- GLRen.createContinuousLine(tex.getTexId(), width, points);
+ GLRen.createContinuousLine(tex.getTexId(), width, joinStyle, chain,
points, points.length);
vs.map.put(cl, coordsys1);
- */
return 0;
}
}
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.26 libvob/src/jni/Makefile:1.27
--- libvob/src/jni/Makefile:1.26 Thu Apr 24 13:49:42 2003
+++ libvob/src/jni/Makefile Tue Apr 29 20:33:56 2003
@@ -5,7 +5,7 @@
VOB_OBJS = $(VOBS:%=%.vobjniobj)
TRANS_OBJS = $(TRANS:%=%.transjniobj)
-sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx
Font.cxx Paper.cxx Image.cxx
+sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx
Font.cxx Paper.cxx Image.cxx Lines.cxx
@@ -14,7 +14,8 @@
GLMOSAICTEXT=../../../glmosaictext
GLMOSAICTEXTOBJS=$(GLMOSAICTEXT)/src/Text.o $(GLMOSAICTEXT)/src/Mosaic.o
-PAPEROBJS=../paper/Paper.o
+LINESOBJ=../lines/Lines.o
+PAPEROBJS=../paper/Paper.o
OSOBJS=../os/Os-GLX.o
TEXTUREOBJS=../texture/Texture.o ../texture/Texture_pipetexture.o
UTILOBJS=../util/Perlin.o ../util/buildmipmaps.o ../util/Debug.o
../util/ImageLoader.o
@@ -25,7 +26,7 @@
OBJS= $(sources:%.cxx=%.o)
-JNIOBJS=$(OBJS) $(VOB_OBJS) $(TRANS_OBJS) $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS)
$(CALLGLOBJS) $(TRANSOBJS) $(MAINOBJS) $(GLMOSAICTEXTOBJS) $(PAPEROBJS)
+JNIOBJS=$(OBJS) $(VOB_OBJS) $(TRANS_OBJS) $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS)
$(CALLGLOBJS) $(TRANSOBJS) $(MAINOBJS) $(GLMOSAICTEXTOBJS) $(PAPEROBJS)
$(LINESOBJ)
EXTRAINCLUDE=-I${JAVAHOME}/include -I${JAVAHOME}/include/linux
Index: libvob/src/jni/Modules
diff -u libvob/src/jni/Modules:1.3 libvob/src/jni/Modules:1.4
--- libvob/src/jni/Modules:1.3 Tue Apr 29 07:22:41 2003
+++ libvob/src/jni/Modules Tue Apr 29 20:33:56 2003
@@ -12,6 +12,7 @@
Paper \
Irregu \
Program \
- GLState
+ GLState \
+ Lines
Index: libvob/src/jni/jnivobs.hxx
diff -u libvob/src/jni/jnivobs.hxx:1.5 libvob/src/jni/jnivobs.hxx:1.6
--- libvob/src/jni/jnivobs.hxx:1.5 Tue Apr 1 06:03:54 2003
+++ libvob/src/jni/jnivobs.hxx Tue Apr 29 20:33:56 2003
@@ -14,6 +14,7 @@
#include <vob/vobs/Text.hxx>
#include <vob/vobs/Paper.hxx>
#include <vob/vobs/Irregu.hxx>
+#include <vob/vobs/Lines.hxx>
#include <vob/trans/LinearPrimitives.hxx>
#include <vob/trans/FunctionalPrimitives.hxx>
Index: libvob/src/lines/Lines.cxx
diff -u libvob/src/lines/Lines.cxx:1.2 libvob/src/lines/Lines.cxx:1.3
--- libvob/src/lines/Lines.cxx:1.2 Mon Apr 28 16:55:19 2003
+++ libvob/src/lines/Lines.cxx Tue Apr 29 20:33:56 2003
@@ -91,10 +91,10 @@
* Continuous Line
* ===============
*/
- ContinuousLine::ContinuousLine(GLuint textId, int cornerBehaviour,
- float lineWidth, bool chain,
+ ContinuousLine::ContinuousLine(GLuint textId, float lineWidth,
+ int joinStyle, bool chain,
float * points, int size) {
- ContinuousLine(textId, cornerBehaviour, lineWidth, chain);
+ ContinuousLine(textId, joinStyle, lineWidth, chain);
if ( (size % 3) != 0) {
cerr << "Lines error:: Size not divisible by three (x,y,z)!\n";
@@ -108,8 +108,8 @@
ContinuousLine::ContinuousLine(GLuint textId,
- int cornerBehaviour,
float lineWidth,
+ int joinStyle,
bool chain):
drawDone(false), chain(chain)
{
@@ -118,12 +118,12 @@
return;
}
- if (cornerBehaviour == BEVEL ||
- cornerBehaviour == MITER ||
- cornerBehaviour == ROUND)
+ if (joinStyle == BEVEL ||
+ joinStyle == MITER ||
+ joinStyle == ROUND)
this->textureId = textId;
else {
- cerr << "Lines error:: Not a good cornerBehaviour: "
+ cerr << "Lines error:: Not a good joinStyle: "
<< textId <<"\n";
return;
}
Index: libvob/src/texture/line.texture
diff -u libvob/src/texture/line.texture:1.1 libvob/src/texture/line.texture:1.2
--- libvob/src/texture/line.texture:1.1 Mon Mar 10 00:38:19 2003
+++ libvob/src/texture/line.texture Tue Apr 29 20:33:56 2003
@@ -1,3 +1,4 @@
+// -*-C++-*-
/*
line.texture
*
@@ -26,7 +27,6 @@
* Written by Matti Katila and Tuomas J. Lukka
*/
-// -*-C++-*-
void GENERATE(TextureParam *params, int width, int height, int depth, int
components, float *data) {
if(components != 1) return;
@@ -61,7 +61,7 @@
case 2:
data[index + 0] = 0.25;
data[index + 1] = 0.25; break;
- case 1: data[index + 0] = 0.125; break;
+ case 1: data[index + 0] = 0.25; break;
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/li...,
Matti Katila <=