|
From: <at...@us...> - 2007-10-26 19:19:17
|
Revision: 516
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=516&view=rev
Author: atani
Date: 2007-10-26 12:19:14 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
* more NeHe examples
* migrated a couple drawables away from plx to normal OpenGL calls
* more NDS compatibility, all NeHe examples work as expected.
Modified Paths:
--------------
tiki/examples/nehe/Makefile
tiki/examples/nehe/lesson02/src/main.cpp
tiki/examples/nehe/lesson03/Makefile
tiki/examples/nehe/lesson03/src/main.cpp
tiki/examples/net/httpclient/src/main.cpp
tiki/include/Tiki/color.h
tiki/src/gl/drawables/banner.cpp
tiki/src/gl/drawables/console.cpp
tiki/src/gl/drawables/pointerArrow.cpp
tiki/src/gl/gl.cpp
Added Paths:
-----------
tiki/examples/nehe/lesson03/
tiki/examples/nehe/lesson04/
tiki/examples/nehe/lesson04/Makefile
tiki/examples/nehe/lesson04/src/
tiki/examples/nehe/lesson04/src/main.cpp
tiki/examples/nehe/lesson05/
tiki/examples/nehe/lesson05/Makefile
tiki/examples/nehe/lesson05/src/
tiki/examples/nehe/lesson05/src/main.cpp
Removed Paths:
-------------
tiki/examples/nehe/lesson01/
Property Changed:
----------------
tiki/examples/nehe/lesson02/src/
tiki/examples/nehe/lesson03/src/
Modified: tiki/examples/nehe/Makefile
===================================================================
--- tiki/examples/nehe/Makefile 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -1,5 +1,5 @@
-SUBDIRS = lesson01 lesson02
+SUBDIRS = lesson02 lesson03 lesson04 lesson05
TIKI_DIR ?= $(CURDIR)/../../
include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson02/src
___________________________________________________________________
Name: svn:ignore
+ *.d
*.nds
*.ds.gba
Modified: tiki/examples/nehe/lesson02/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson02/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson02/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -22,16 +22,10 @@
Frame::set3d();
// Set the current matrix to be the model matrix
- glMatrixMode(GL_MODELVIEW);
-
- //Push our original Matrix onto the stack (save state)
- //glPushMatrix();
+ glMatrixMode(GL_MODELVIEW);
DrawGLScene();
- // Pop our Matrix from the stack (restore state)
- //glPopMatrix();
-
Frame::finish();
}
Copied: tiki/examples/nehe/lesson03 (from rev 515, tiki/examples/nehe/lesson01)
Modified: tiki/examples/nehe/lesson03/Makefile
===================================================================
--- tiki/examples/nehe/lesson01/Makefile 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson03/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -4,22 +4,22 @@
OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
ifeq ($(TIKI_PLAT),nds)
-NDS_CART_CODE ?= NH01
+NDS_CART_CODE ?= NH03
NDS_CART_ID ?= NH
-NDS_CART_NAME ?= NeHe01
+NDS_CART_NAME ?= NeHe03
NDS_CART_VERSION ?= 1
endif
-all: nehe_lesson01
-nehe_lesson01: $(OBJS)
+all: nehe_lesson03
+nehe_lesson03: $(OBJS)
$(build_romdisk)
- $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson03$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
$(post_build)
clean:
- -rm -f $(OBJS) nehe_lesson01$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ -rm -f $(OBJS) nehe_lesson03$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
ifeq ($(TIKI_PLAT),nds)
- -rm -f nehe_lesson01.nds nehe_lesson01.ds.gba
+ -rm -f nehe_lesson03.nds nehe_lesson03.ds.gba
endif
TIKI_DIR ?= $(CURDIR)/../../../
Property changes on: tiki/examples/nehe/lesson03/src
___________________________________________________________________
Name: svn:ignore
+ *.d
*.nds
*.ds.nds
Modified: tiki/examples/nehe/lesson03/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson01/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/nehe/lesson03/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -18,20 +18,12 @@
while (1)
{
Frame::begin();
+ Frame::set3d();
// Set the current matrix to be the model matrix
glMatrixMode(GL_MODELVIEW);
- // Set the color..not in nehe source...ds gl default will be black
- glColor3f(1, 1, 1);
-
- //Push our original Matrix onto the stack (save state)
- //glPushMatrix();
-
DrawGLScene();
-
- // Pop our Matrix from the stack (restore state)
- //glPopMatrix();
Frame::finish();
}
@@ -39,8 +31,24 @@
return 0;
}
-void DrawGLScene(void)
+void DrawGLScene() // Here's Where We Do All The Drawing
{
- //this is where the magic happens
- glLoadIdentity();
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glBegin(GL_TRIANGLES); // Drawing Using Triangles
+ glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top
+ glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glEnd(); // Finished Drawing The Triangle
+ glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
+ glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
+ glBegin(GL_QUADS); // Draw A Quad
+ glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
+ glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glEnd(); // Done Drawing The Quad
}
Property changes on: tiki/examples/nehe/lesson04
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
Added: tiki/examples/nehe/lesson04/Makefile
===================================================================
--- tiki/examples/nehe/lesson04/Makefile (rev 0)
+++ tiki/examples/nehe/lesson04/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH04
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe04
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson04
+nehe_lesson04: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson04$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson04$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson04.nds nehe_lesson04.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson04/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Property changes on: tiki/examples/nehe/lesson04/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Added: tiki/examples/nehe/lesson04/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson04/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson04/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,69 @@
+/****************************************
+ * NDS NeHe Lesson 04 *
+ * Author: Dovoto *
+ ****************************************/
+
+// include your ndslib
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+
+void DrawGLScene();
+
+float rtri; // Angle For The Triangle ( NEW )
+float rquad; // Angle For The Quad ( NEW )
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ while (1)
+ {
+ Frame::begin();
+ Frame::set3d();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ // draw the scene
+ DrawGLScene();
+
+ Frame::finish();
+ }
+
+ return 0;
+}
+
+void DrawGLScene() // Here's Where We Do All The Drawing
+{
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )
+ glColor3f(1, 1, 1); // set the vertex color
+ glBegin(GL_TRIANGLES); // Start Drawing A Triangle
+ glColor3f(1.0f,0.0f,0.0f); // Set Top Point Of Triangle To Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // First Point Of The Triangle
+ glColor3f(0.0f,1.0f,0.0f); // Set Left Point Of Triangle To Green
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Second Point Of The Triangle
+ glColor3f(0.0f,0.0f,1.0f); // Set Right Point Of Triangle To Blue
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Third Point Of The Triangle
+ glEnd(); // Done Drawing The Triangle
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(1.5f,0.0f,-6.0f); // Move Right 1.5 Units And Into The Screen 6.0
+ glRotatef(rquad,1.0f,0.0f,0.0f); // Rotate The Quad On The X axis ( NEW )
+ glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
+ glBegin(GL_QUADS); // Draw A Quad
+ glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
+ glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
+ glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
+ glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
+ glEnd(); // Done Drawing The Quad
+ rtri+=0.9f; // Increase The Rotation Variable For The Triangle ( NEW )
+ rquad-=0.75f; // Decrease The Rotation Variable For The Quad ( NEW )
+}
Property changes on: tiki/examples/nehe/lesson05
___________________________________________________________________
Name: svn:ignore
+ *.nds
*.ds.gba
Added: tiki/examples/nehe/lesson05/Makefile
===================================================================
--- tiki/examples/nehe/lesson05/Makefile (rev 0)
+++ tiki/examples/nehe/lesson05/Makefile 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,27 @@
+
+
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+ifeq ($(TIKI_PLAT),nds)
+NDS_CART_CODE ?= NH05
+NDS_CART_ID ?= NH
+NDS_CART_NAME ?= NeHe05
+NDS_CART_VERSION ?= 1
+endif
+
+all: nehe_lesson05
+nehe_lesson05: $(OBJS)
+ $(build_romdisk)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o nehe_lesson05$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ $(post_build)
+
+clean:
+ -rm -f $(OBJS) nehe_lesson05$(PLATFORM_BINARY_EXT) $(ROMDISK_OBJ)
+ifeq ($(TIKI_PLAT),nds)
+ -rm -f nehe_lesson05.nds nehe_lesson05.ds.gba
+endif
+
+TIKI_DIR ?= $(CURDIR)/../../../
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Property changes on: tiki/examples/nehe/lesson05/Makefile
___________________________________________________________________
Name: svn:executable
+ *
Property changes on: tiki/examples/nehe/lesson05/src
___________________________________________________________________
Name: svn:ignore
+ *.d
Added: tiki/examples/nehe/lesson05/src/main.cpp
===================================================================
--- tiki/examples/nehe/lesson05/src/main.cpp (rev 0)
+++ tiki/examples/nehe/lesson05/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -0,0 +1,108 @@
+/****************************************
+ * NDS NeHe Lesson 05 *
+ * Author: Dovoto *
+ ****************************************/
+
+// include your ndslib
+#include <Tiki/tiki.h>
+#include <Tiki/gl.h>
+
+using namespace Tiki;
+using namespace Tiki::GL;
+
+void DrawGLScene();
+
+float rtri; // Angle For The Triangle ( NEW )
+float rquad; // Angle For The Quad ( NEW )
+
+int main(int argc, char *argv[])
+{
+ Tiki::init(argc, argv);
+
+ while (1)
+ {
+ Frame::begin();
+ Frame::set3d();
+
+ // Set the current matrix to be the model matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ DrawGLScene();
+
+ Frame::finish();
+ }
+
+ return 0;
+}
+
+void DrawGLScene() // Here's Where We Do All The Drawing
+{
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
+ glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )
+ glBegin(GL_TRIANGLES); // Start Drawing A Triangle
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back)
+ glColor3f(1.0f,0.0f,0.0f); // Red
+ glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left)
+ glColor3f(0.0f,0.0f,1.0f); // Blue
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left)
+ glColor3f(0.0f,1.0f,0.0f); // Green
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left)
+ glEnd(); // Done Drawing The Pyramid
+
+ glLoadIdentity(); // Reset The Current Modelview Matrix
+ glTranslatef(1.5f,0.0f,-7.0f); // Move Right 1.5 Units And Into The Screen 7.0
+ glRotatef(rquad,1.0f,1.0f,1.0f); // Rotate The Quad On The X axis ( NEW )
+ glBegin(GL_QUADS); // Draw A Quad
+ glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top)
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)
+ glColor3f(1.0f,0.5f,0.0f); // Set The Color To Orange
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom)
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom)
+ glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front)
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front)
+ glColor3f(1.0f,1.0f,0.0f); // Set The Color To Yellow
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Top Right Of The Quad (Back)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Top Left Of The Quad (Back)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Bottom Left Of The Quad (Back)
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Bottom Right Of The Quad (Back)
+ glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
+ glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
+ glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left)
+ glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left)
+ glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left)
+ glColor3f(1.0f,0.0f,1.0f); // Set The Color To Violet
+ glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right)
+ glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
+ glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right)
+ glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right)
+ glEnd(); // Done Drawing The Quad
+
+ rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
+ rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW )
+}
Modified: tiki/examples/net/httpclient/src/main.cpp
===================================================================
--- tiki/examples/net/httpclient/src/main.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/examples/net/httpclient/src/main.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -59,7 +59,7 @@
console->setSize(640, 480);
console->setTranslate( Vector( 320, 240, 0 ) );
#else
- console->setSize(256, 192);
+ console->setSize(255, 191);
console->setTranslate( Vector( 128, 96, 0 ) );
#endif
console->setAutoWrap( true );
@@ -80,7 +80,7 @@
cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
}
else {
- console->printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
+ console->printf("COOKIE: %s (version->%s,value->%s,path->%s,max-age->%d,domain->%s,secure->%s)\n",
cookie->getName().c_str(), cookie->getVersion().c_str(), cookie->getValue().c_str(), cookie->getPath().c_str(), cookie->getMaxAge(),
cookie->getDomain().c_str(), cookie->isSecure() ? "true" : "false");
}
Modified: tiki/include/Tiki/color.h
===================================================================
--- tiki/include/Tiki/color.h 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/include/Tiki/color.h 2007-10-26 19:19:14 UTC (rev 516)
@@ -84,8 +84,7 @@
#if TIKI_PLAT != TIKI_NDS
glColor4f( r, g, b, a );
#else
-
- glColor3f( r, g, b );
+ glColor(pack1555(r, g, b, a));
#endif
}
@@ -96,6 +95,12 @@
( ( ( int ) ( g * 255 ) ) << 8 ) |
( ( ( int ) ( b * 255 ) ) );
}
+ static uint32 pack1555( float a, float r, float g, float b ) {
+ return ( ( ( ( int ) ( a * 255 ) ) >> 7 ) << 8 ) |
+ ( ( ( ( int ) ( r * 255 ) ) >> 3 ) << 10 ) |
+ ( ( ( ( int ) ( g * 255 ) ) >> 3 ) << 5 ) |
+ ( ( ( ( int ) ( b * 255 ) ) >> 4 ) );
+ }
float a, r, g, b;
};
Modified: tiki/src/gl/drawables/banner.cpp
===================================================================
--- tiki/src/gl/drawables/banner.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/banner.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -70,38 +70,23 @@
const Vector & tv = getPosition();
- plx_vertex_t vert;
- if (list == Trans) {
- vert.argb = getColor();
- } else {
- Color t = getColor(); t.a = 1.0f;
- vert.argb = t;
- }
- vert.oargb = 0;
+ Color argb = getColor();
- vert.flags = PLX_VERT;
- vert.x = tv.x-w/2;
- vert.y = tv.y+h/2;
- vert.z = tv.z;
- vert.u = m_u1;
- vert.v = m_v1;
- plx_prim(&vert, sizeof(vert));
-
- vert.y = tv.y-h/2;
- vert.u = m_u2;
- vert.v = m_v2;
- plx_prim(&vert, sizeof(vert));
-
- vert.x = tv.x+w/2;
- vert.y = tv.y+h/2;
- vert.u = m_u3;
- vert.v = m_v3;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y-h/2;
- vert.u = m_u4;
- vert.v = m_v4;
- plx_prim(&vert, sizeof(vert));
+ if (list != Trans) {
+ argb.a = 1.0f;
+ }
+
+ argb.select();
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glTexCoord2f(m_u1, m_v1);
+ glVertex3f(tv.x - w/2, tv.y + h/2, tv.z);
+ glTexCoord2f(m_u2, m_v2);
+ glVertex3f(tv.x - w/2, tv.y - h/2, tv.z);
+ glTexCoord2f(m_u3, m_v3);
+ glVertex3f(tv.x + w/2, tv.y + h/2, tv.z);
+ glTexCoord2f(m_u4, m_v4);
+ glVertex3f(tv.x + w/2, tv.y - h/2, tv.z);
+ glEnd();
}
Modified: tiki/src/gl/drawables/console.cpp
===================================================================
--- tiki/src/gl/drawables/console.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/console.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -38,7 +38,6 @@
m_texture->select();
#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS
-
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
#endif
@@ -222,88 +221,46 @@
void ConsoleText::renderCharacter( float x, float y, float w, float h, unsigned char c, int attr )
{
- plx_vertex_t vert;
float u = static_cast<float>( ( c % 16 ) * 8 );
float v = static_cast<float>( ( c / 16 ) * 8 );
- int color = attr & 0x07;
-
const Vector & sv = getScale();
w *= sv.x;
h *= sv.y;
const Vector & tv = getPosition() + Vector( x, y, 0.01f );
- m_texture->select();
-
+ Color color = m_palette[BLACK];
if ( attr & HIGH_INTENSITY )
{
- vert.argb = Color( 0.25, 0.25, 0.25 );
- //color -= 8;
+ color += Color( 0.25, 0.25, 0.25 );
}
- else
- {
- vert.argb = Color( 0, 0, 0 );
- }
- vert.argb += m_palette[ color ];
- vert.oargb = 0;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.z = tv.z;
- vert.u = u / m_texture->getW();
- vert.v = ( v + 8 ) / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.y = tv.y - m_h / 2;
- vert.u = u / m_texture->getH();
- vert.v = v / m_texture->getW();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.x = tv.x + w - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.u = ( u + 8 ) / m_texture->getW();
- vert.v = ( v + 8 ) / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y - m_h / 2;
- vert.u = ( u + 8 ) / m_texture->getW();
- vert.v = v / m_texture->getH();
- plx_prim( &vert, sizeof( vert ) );
+ color += m_palette[ attr & 0x07 ];
+ color.select();
+
+ glTexCoord2f(u/m_texture->getW(), (v+8)/m_texture->getH());
+ glVertex3f(tv.x - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
+ glTexCoord2f(u/m_texture->getW(), v/m_texture->getH());
+ glVertex3f(tv.x - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glTexCoord2f((u+8)/m_texture->getW(), v/m_texture->getH());
+ glVertex3f(tv.x + w - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glTexCoord2f((u+8)/m_texture->getW(), (v+8)/m_texture->getH());
+ glVertex3f(tv.x + w - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
}
void ConsoleText::renderBackground( float x, float y, float w, float h, int color )
{
- plx_vertex_t vert;
const Vector & sv = getScale();
w *= sv.x;
h *= sv.y;
const Vector & tv = getPosition() + Vector( x, y, -0.01f );
-
- m_texture->deselect();
-
- vert.argb = m_palette[ color ];
- vert.oargb = 0;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- vert.z = tv.z;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.y = tv.y - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.x = tv.x + w - m_w / 2;
- vert.y = tv.y + h - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
-
- vert.flags = PLX_VERT_EOS;
- vert.y = tv.y - m_h / 2;
- plx_prim( &vert, sizeof( vert ) );
+ m_palette[ color ].select();
+
+ glVertex3f(tv.x - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
+ glVertex3f(tv.x - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glVertex3f(tv.x + w - (m_w / 2), tv.y - (m_h / 2), tv.z);
+ glVertex3f(tv.x + w - (m_w / 2), tv.y + h - (m_h / 2), tv.z);
}
void ConsoleText::draw( ObjType list )
@@ -313,23 +270,33 @@
float y_step = ( m_h / m_rows );
#if TIKI_PLAT != TIKI_NDS
-
glDisable( GL_DEPTH_TEST );
#endif
-
- for ( y = 0; y < m_rows; y++ )
- {
- for ( x = 0; x < m_cols; x++ )
+ if ( list == Trans )
+ { //Characters!
+ m_texture->select();
+ glBegin(GL_QUADS);
+ for ( y = 0; y < m_rows; y++ )
{
- if ( list == Trans )
- { //Characters!
+ for ( x = 0; x < m_cols; x++ )
+ {
renderCharacter( x * x_step, y * y_step, x_step, y_step, m_charData[ y * ( m_cols ) + x ], m_colorData[ y * ( m_cols ) + x ] );
}
- else
- { //Background blocks!
+ }
+ glEnd();
+ }
+ else
+ { //Background blocks!
+ m_texture->deselect();
+ glBegin(GL_QUADS);
+ for ( y = 0; y < m_rows; y++ )
+ {
+ for ( x = 0; x < m_cols; x++ )
+ {
renderBackground( x * x_step, y * y_step, x_step, y_step, ( m_colorData[ y * ( m_cols ) + x ] >> 8 ) & 0x07 );
}
}
+ glEnd();
}
}
Modified: tiki/src/gl/drawables/pointerArrow.cpp
===================================================================
--- tiki/src/gl/drawables/pointerArrow.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/drawables/pointerArrow.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -29,40 +29,20 @@
Texture::deselect();
if(list==Trans) {
- vert.argb = Color(0,0,0);
- vert.z = tv.z;
+ Color black = Color(0,0,0);
+ black.select();
- vert.flags = PLX_VERT;
- vert.x = tv.x-2;
- vert.y = tv.y-4;
- plx_prim(&vert, sizeof(vert));
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex3f(tv.x - 2, tv.y - 4, tv.z);
+ glVertex3f(tv.x + 18, tv.y + 16, tv.z);
+ glVertex3f(tv.x - 2, tv.y + 24, tv.z);
+ glEnd();
- vert.flags = PLX_VERT;
- vert.x = tv.x+18;
- vert.y = tv.y+16;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.x = tv.x-2;
- vert.y = tv.y+24;
- plx_prim(&vert, sizeof(vert));
-
- vert.argb = getTint();
- vert.z = tv.z + 0.01f;
-
- vert.flags = PLX_VERT;
- vert.x = tv.x;
- vert.y = tv.y;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT;
- vert.x = tv.x+15;
- vert.y = tv.y+15;
- plx_prim(&vert, sizeof(vert));
-
- vert.flags = PLX_VERT_EOS;
- vert.x = tv.x;
- vert.y = tv.y+21;
- plx_prim(&vert, sizeof(vert));
+ getTint().select();
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex3f(tv.x, tv.y, tv.z + 0.01f);
+ glVertex3f(tv.x + 15, tv.y + 15, tv.z + 0.01f);
+ glVertex3f(tv.x, tv.y + 21, tv.z + 0.01f);
+ glEnd();
}
}
Modified: tiki/src/gl/gl.cpp
===================================================================
--- tiki/src/gl/gl.cpp 2007-10-25 23:42:44 UTC (rev 515)
+++ tiki/src/gl/gl.cpp 2007-10-26 19:19:14 UTC (rev 516)
@@ -37,11 +37,9 @@
glDepthMask( GL_TRUE );
glShadeModel( GL_SMOOTH );
glDisable( GL_CULL_FACE );
-#endif
set2d();
-#if TIKI_PLAT != TIKI_NDS
glViewport( 0, 0, 640, 480 );
glClearDepth( 0.0f );
#if TIKI_PLAT != TIKI_DC
@@ -51,13 +49,12 @@
#endif
#else // TIKI_NDS
- //glViewport( 0, 0, 255, 191 );
- //glClearDepth( 0x7FFFF );
- //glClearColor( 0, 0, 0, 31 );
+
+ // the DS is not happy in ortho mode, so force back to 3d
+ set3d();
#endif
- glLoadIdentity();
-
+ glLoadIdentity();
transDisable();
}
@@ -67,7 +64,7 @@
#if TIKI_PLAT != TIKI_NDS
glOrtho( 0, 640, 480, 0, 1.0f, -1.0f );
#else
- glOrtho( 0, 256, 192, 0, 0.1f, 100.0f );
+ glOrtho( 0, 256, 192, 0, 0.1f, 100.0f );
#endif
glMatrixMode( GL_MODELVIEW );
}
@@ -98,6 +95,8 @@
#endif
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+#else // TIKI_NDS
+ glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
#endif
}
@@ -105,6 +104,8 @@
// glEnable(GL_DEPTH_TEST);
#if TIKI_PLAT != TIKI_NDS
glDisable( GL_BLEND );
+#else
+ glPolyFmt(POLY_ALPHA(0) | POLY_CULL_NONE);
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|