[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/liblines Lines.cxx Lines.hxx liblines-p...
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gfx/liblines Lines.cxx Lines.hxx liblines-p... |
Date: |
Wed, 18 Dec 2002 11:16:55 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/12/18 11:16:52
Modified files:
gfx/liblines : Lines.cxx Lines.hxx liblines-plan.txt
Log message:
some fixes + added first shot of interface for continuouslines.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.cxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.hxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/liblines-plan.txt.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/gfx/liblines/Lines.cxx
diff -u gzz/gfx/liblines/Lines.cxx:1.15 gzz/gfx/liblines/Lines.cxx:1.16
--- gzz/gfx/liblines/Lines.cxx:1.15 Tue Dec 10 15:40:19 2002
+++ gzz/gfx/liblines/Lines.cxx Wed Dec 18 11:16:51 2002
@@ -28,12 +28,13 @@
// PRIVATE:
/* makes 1D-texture:
- * ___________________
- * |__|__|xx|xx|__|__|
+ *
+ * _________________________
+ * |__|__|__|xx|xx|__|__|__|
*
* -where x are black pixels
*/
- void Lines::init() {
+ void SimpleLine::init() {
glGenTextures(1, texName);
glBindTexture(GL_TEXTURE_1D, texName[0]);
@@ -49,7 +50,7 @@
int steps = size / 8;
int low = steps * 3;
- int high = steps * 5;
+ int high = steps * 4;
if ( size > 4) {
for (int i=low; i<high; i++) {
@@ -80,7 +81,7 @@
}
// PUBLIC:
- Lines::~Lines() {
+ SimpleLine::~SimpleLine() {
glDeleteTextures(MIPMAPS, texName);
}
@@ -93,7 +94,7 @@
* |clamp|te | black |te | clamp
* | | | | | |
* +-----+---+-------+---+-----+
- * 0 t0 3/8 5/8 t1 1
+ * 0 t0 4/8 5/8 t1 1
*
* |< >| ¦< >|
* 2 pixels 2 pixels
@@ -105,15 +106,15 @@
* t0 = 1 - t1
*
*
- * 5/8 - 3/8 t1 - 10
+ * 5/8 - 4/8 t1 - 10
* --------- = ---------
* w 2 + w + 2
*
*
- * t0 = 0.5 - (4+w)/8w
+ * t0 = 0.5 - (4+w)/16w
*/
- void Lines::draw(ZPt a, ZPt b) {
+ void SimpleLine::draw(ZPt a, ZPt b) {
if (dbg) cout << linewidth;
if (dbg) cout <<" x: "<< a.x << ", "<< b.x
<<" y: "<< a.y << ", "<< b.y <<"\n";
@@ -139,7 +140,7 @@
l.x *= total_width;
l.y *= total_width;
- float t0 = 0.5 - ( (4+linewidth) / (8*linewidth) );
+ float t0 = 0.5 - ( (4+linewidth) / (16*linewidth) );
float t1 = 1 - t0;
if (dbg) cout <<"t1: " << t1 <<" t0 :" << t0 << endl;
@@ -163,5 +164,20 @@
glPopAttrib();
}
-}
+
+
+ ContinuousLine::ContinuousLine(int textId, string corner_behaviour, float
linewidth) {}
+ ContinuousLine::~ContinuousLine() {}
+
+ void ContinuousLine::add(float * point) {
+ }
+
+ void ContinuousLine::makeChain() {}
+
+ void ContinuousLine::draw() {}
+
+
+
+
+} // end of Lines namespace
Index: gzz/gfx/liblines/Lines.hxx
diff -u gzz/gfx/liblines/Lines.hxx:1.5 gzz/gfx/liblines/Lines.hxx:1.6
--- gzz/gfx/liblines/Lines.hxx:1.5 Sat Nov 2 15:08:08 2002
+++ gzz/gfx/liblines/Lines.hxx Wed Dec 18 11:16:51 2002
@@ -11,13 +11,14 @@
//PREDBGVAR(dbg);
+ using std::string;
using std::vector;
using std::ostream;
using std::cout;
using Vec23::ZPt;
- class Lines {
+ class SimpleLine {
float linewidth;
bool has_not_inited;
@@ -25,14 +26,48 @@
void init();
public:
- Lines(float l): linewidth(l), has_not_inited(true) { }
- ~Lines();
+ SimpleLine(float l): linewidth(l), has_not_inited(true) { }
+ ~SimpleLine();
/** Draws a line from point a to b.
* You have to transform a and b _before_
*/
void draw(ZPt a, ZPt b);
};
+
+
+ /** ContinuousLine is line constructed from various points.
+ * It bends in given points.
+ */
+ class ContinuousLine {
+ private:
+ vector<float> points;
+ bool foo;
+ public:
+ /** ContinuousLine is line constructed from various points.
+ * It bends in given points.
+ * @params
+ * textId = texture's id - must be > 0.
+ * corner_behaviour =
+ * "Bevel", "Miter" or "Round"
+ */
+ ContinuousLine(int textId, string corner_behaviour, float linewidth);
+ ~ContinuousLine();
+
+ /** Add new point at the end of line.
+ */
+ void add(float * point);
+
+ /** Join first and last point.
+ */
+ void makeChain();
+
+ /** Draw the continuous line.
+ */
+ void draw();
+ };
+
+
}
#endif
Index: gzz/gfx/liblines/liblines-plan.txt
diff -u gzz/gfx/liblines/liblines-plan.txt:1.2
gzz/gfx/liblines/liblines-plan.txt:1.3
--- gzz/gfx/liblines/liblines-plan.txt:1.2 Mon Dec 16 10:28:37 2002
+++ gzz/gfx/liblines/liblines-plan.txt Wed Dec 18 11:16:51 2002
@@ -5,17 +5,24 @@
* 2002-12-16T15:48
*/
+Update: Bewels got dropped out because of complexivity.
+Too much other geometry things.
+
+
+http://mardiweb.com/web/psp7/tools/draw/draw.htm
+
+
This is a plain plan file.
Constructed for clarify things under the topics:
-simple line
-continuous line
- -bewels
-
- -diceing?
Affects:
-texture(s)
- -diceing
+ -clampping
+
+Some interface planning.
+
@@ -42,7 +49,7 @@
-A one possible solution:
+A one possible solution - Bevel:
-add one quad
/---------------------
@@ -65,7 +72,7 @@
-Another solution:
+Another solution - Miter:
-interpolation/extrapolation with vertex length.
@@ -90,9 +97,9 @@
when extrapolation get going and going...
-Yet another one:
+Yet another one - Round:
-Add slice/sector of circle texture.
--bewls would be very pleased with this kind of corners.
+-bewes would be very pleased with this kind of corners.
@@ -130,6 +137,52 @@
//--------------------------------------------------
+
+Interfaces
+----------
+
+C++:
+
+constructor(float linewidth);
+
+Simple line:
+ -almoust done
+
+ -Create one instance
+ -set texture
+ -make some lines.
+ -any comments?
+
+
+Continuous lines:
+ -Create an instance
+ -set texture
+ -select a corner behaviour
+ -add points
+ -draw (at least in destructor)
+ -close_chain() can be used to connect last to the first point.
+
+
+Java:
+ SimpleLineVob(float linewidth, float[] a_and_b);
+ ContinuousLineVob
+
+ int point_count = 17;
+ float points[] = new float[points_count];
+
+ // set points...
+ for(...);
+
+
+
+
+
+
+
+//--------------------------------------------------
+
+DROPPED OUT!
+
2) How continuous lines affect to bewels?
Continuous lines can be used to create bewels.
@@ -139,7 +192,7 @@
How textures' color is made?
1) By setting glColor before drawing with ALPHA texture
- Extremely must and nice to have :)
+ Extremely nice to have :)
2) By different textures - must for inner/outer slide.
@@ -160,29 +213,6 @@
-
-
-Interfaces
-----------
-
-constructor(float linewidth);
-
-Simple line:
- -almoust done
-
- -Create one instance
- -set texture
- -make some lines.
- -any comments?
-
-
-Continuous lines:
- -Create an instance
- -set texture
- -select a corner behaviour
- -add points
- -draw (at least in destructor)
- -close_chain() can be used to connect last to the first point.
Bewels:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx/liblines Lines.cxx Lines.hxx liblines-p...,
Matti Katila <=