From: <at...@us...> - 2006-07-06 19:18:35
|
Revision: 347 Author: atani Date: 2006-07-06 12:18:05 -0700 (Thu, 06 Jul 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=347&view=rev Log Message: ----------- initial NDS port, nonfunctional so far but it compiles cleanly with DevKitARM(DevKitPro) r19a and libnds 20060621 Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/include/Tiki/color.h tiki/include/Tiki/plxcompat.h tiki/include/Tiki/sound.h tiki/include/Tiki/stream.h tiki/include/Tiki/texture.h tiki/src/gl/drawables/console.cpp tiki/src/gl/genmenu.cpp tiki/src/gl/gl.cpp tiki/src/gl/plxcompat.cpp tiki/src/gl/texture.cpp Added Paths: ----------- tiki/nds/ tiki/nds/Makefile tiki/nds/Makefile.rules tiki/nds/include/ tiki/nds/include/Tiki/ tiki/nds/include/Tiki/glhdrs.h tiki/nds/include/Tiki/platthread.h tiki/nds/include/Tiki/tikitypes.h tiki/nds/include/ogg/ tiki/nds/include/ogg/config_types.h tiki/nds/include/pch.h tiki/nds/lib/ tiki/nds/src/ tiki/nds/src/Makefile tiki/nds/src/init_shutdown.cpp tiki/nds/src/platgl.cpp tiki/nds/src/plathid.cpp tiki/nds/src/platthread.cpp tiki/nds/src/tikitime.cpp Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/examples/TikiTest/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -1,11 +1,13 @@ -CFLAGS=-I../../$(TIKI_PLAT)/include -I../../include +TIKI_DIR=../../ +CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../../$(TIKI_PLAT) -L../../$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest -include ../../$(TIKI_PLAT)/Makefile.rules +DEPSDIR=$(CURDIR) +include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules Modified: tiki/include/Tiki/color.h =================================================================== --- tiki/include/Tiki/color.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/color.h 2006-07-06 19:18:05 UTC (rev 347) @@ -80,7 +80,11 @@ } void select() const { +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } static uint32 pack(float a, float r, float g, float b) { Modified: tiki/include/Tiki/plxcompat.h =================================================================== --- tiki/include/Tiki/plxcompat.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/plxcompat.h 2006-07-06 19:18:05 UTC (rev 347) @@ -249,7 +249,11 @@ uint8 g = (uint8)((argb >> 8) & 0xff); uint8 b = (uint8)((argb >> 0) & 0xff); uint8 a = (uint8)((argb >> 24) & 0xff); +#if TIKI_PLAT != TIKI_NDS glColor4ub(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } // This function will handle the meat of the Parallax emulation. Note @@ -346,7 +350,11 @@ */ static inline void plx_vert_fnp(int flags, float x, float y, float z, float a, float r, float g, float b) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glVertex3f(x, y, z / zscale); PRIMPOST(flags); } @@ -390,7 +398,11 @@ float a, float r, float g, float b, float u, float v) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glTexCoord2f(u, v); glVertex3f(x, y, z / zscale); PRIMPOST(flags); Modified: tiki/include/Tiki/sound.h =================================================================== --- tiki/include/Tiki/sound.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/sound.h 2006-07-06 19:18:05 UTC (rev 347) @@ -66,11 +66,14 @@ private: bool m_stereo; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffer; -#else +#endif +#if TIKI_PLAT == TIKI_DC sfxhnd_t handle; #endif +#if TIKI_PLAT == TIKI_NDS +#endif static float m_default_vol; }; Modified: tiki/include/Tiki/stream.h =================================================================== --- tiki/include/Tiki/stream.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/stream.h 2006-07-06 19:18:05 UTC (rev 347) @@ -124,7 +124,7 @@ }; State m_state; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffers[2]; ALuint m_source; ALenum m_format; @@ -135,7 +135,7 @@ static void * alThreadProc(void * us); void threadProc(); void check(); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS bool fillBuffer(ALuint buffer); #endif Modified: tiki/include/Tiki/texture.h =================================================================== --- tiki/include/Tiki/texture.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/texture.h 2006-07-06 19:18:05 UTC (rev 347) @@ -89,7 +89,11 @@ int m_w, m_h; // Texture width/height Fmt m_fmt; // Format spec uint8 * m_txrdata; // Pointer to GL-formatted data +#if TIKI_PLAT != TIKI_NDS GLuint m_gltxr; // GL texture handle +#else + int m_gltxr; // GL texture handle +#endif }; }; Added: tiki/nds/Makefile =================================================================== --- tiki/nds/Makefile (rev 0) +++ tiki/nds/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,58 @@ + +# BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp)) +BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp)) +BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp)) +BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/triggers/*.cpp)) +BASE_HID_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/hid/*.cpp)) +BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp)) +BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp)) +BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) + +JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) +PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) +ZLIB_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/zlib/*.c)) +OGG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libogg/src/*.c)) +VORBIS_OBJ=../3rdparty/libvorbis/lib/analysis.o \ + ../3rdparty/libvorbis/lib/bitrate.o \ + ../3rdparty/libvorbis/lib/block.o \ + ../3rdparty/libvorbis/lib/codebook.o \ + ../3rdparty/libvorbis/lib/envelope.o \ + ../3rdparty/libvorbis/lib/floor0.o \ + ../3rdparty/libvorbis/lib/floor1.o \ + ../3rdparty/libvorbis/lib/info.o \ + ../3rdparty/libvorbis/lib/lookup.o \ + ../3rdparty/libvorbis/lib/lpc.o \ + ../3rdparty/libvorbis/lib/lsp.o \ + ../3rdparty/libvorbis/lib/mapping0.o \ + ../3rdparty/libvorbis/lib/mdct.o \ + ../3rdparty/libvorbis/lib/psy.o \ + ../3rdparty/libvorbis/lib/registry.o \ + ../3rdparty/libvorbis/lib/res0.o \ + ../3rdparty/libvorbis/lib/sharedbook.o \ + ../3rdparty/libvorbis/lib/smallft.o \ + ../3rdparty/libvorbis/lib/synthesis.o \ + ../3rdparty/libvorbis/lib/vorbisfile.o \ + ../3rdparty/libvorbis/lib/window.o + +BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \ + $(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \ + $(BASE_THREAD_OBJ) + +THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) + +TIKI_DIR=$(CURDIR)/.. + +SUBDIRS=src + +all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) + $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS) + +clean: clean_subdirs + -rm -f $(BASE_OBJS) libtiki.a + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/.. +include Makefile.rules Property changes on: tiki/nds/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/Makefile.rules =================================================================== --- tiki/nds/Makefile.rules (rev 0) +++ tiki/nds/Makefile.rules 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +subdirs: $(patsubst %, _dir_%, $(SUBDIRS)) + +$(patsubst %, _dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _dir_%, %, $@) + +clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS)) + +$(patsubst %, _clean_dir_%, $(SUBDIRS)): + @$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitARM) +endif + +TIKI_BASE_LIBS=-ltiki -L$(DEVKITPRO)/libnds/lib -lnds9 + + +CXXFLAGS=-I$(DEVKITPRO)/libnds/include +CXXFLAGS+=-I$(TIKI_DIR)/include +CXXFLAGS+=-I$(TIKI_DIR)/nds/include -g +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/zlib +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libjpeg +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libpng +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libogg/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib +CXXFLAGS+=-DARM9 +CXXFLAGS+=-mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb -mthumb-interwork +CFLAGS=$(CXXFLAGS) +CXXFLAGS+=-fno-rtti + +LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc + +include $(DEVKITPRO)/ds_rules Property changes on: tiki/nds/Makefile.rules ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/glhdrs.h =================================================================== --- tiki/nds/include/Tiki/glhdrs.h (rev 0) +++ tiki/nds/include/Tiki/glhdrs.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,16 @@ +/* + Tiki + + glhdrs.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_GLHDRS_H +#define __TIKI_GLHDRS_H + +// This file should include the platform's OpenGL and GLU headers. + +#include <nds.h> + +#endif // __TIKI_GLHDRS_H Property changes on: tiki/nds/include/Tiki/glhdrs.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/platthread.h =================================================================== --- tiki/nds/include/Tiki/platthread.h (rev 0) +++ tiki/nds/include/Tiki/platthread.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,24 @@ +/* + Tiki + + platthread.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_PLATTHREAD_H +#define __TIKI_PLATTHREAD_H + + +namespace Tiki { +namespace Thread { + +typedef void* thread_t; +typedef long mutex_t; +typedef long cond_t; + +} +} + +#endif // __TIKI_PLATTHREAD_H + Property changes on: tiki/nds/include/Tiki/platthread.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/tikitypes.h =================================================================== --- tiki/nds/include/Tiki/tikitypes.h (rev 0) +++ tiki/nds/include/Tiki/tikitypes.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +/* + Tiki + + types.h + + Copyright (C)2000,2001 Dan Potter + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_TYPES_H +#define __TIKI_TYPES_H + +#include <stddef.h> +#include <sys/cdefs.h> +#include <nds/jtypes.h> + +// This gets included in the main tiki.h, so it should suffice. +#define TIKI_OSX 0 +#define TIKI_WIN32 1 +#define TIKI_SDL 2 +#define TIKI_DC 3 +#define TIKI_GP2X 4 +#define TIKI_NDS 5 +#define TIKI_PLAT TIKI_NDS + +namespace Tiki { + +// Pointer arithmetic types +typedef uint32 ptr_t; + +}; + +#endif // __TIKI_TYPES_H + Property changes on: tiki/nds/include/Tiki/tikitypes.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/ogg/config_types.h =================================================================== --- tiki/nds/include/ogg/config_types.h (rev 0) +++ tiki/nds/include/ogg/config_types.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,7 @@ + +#include <nds/jtypes.h> + +typedef int64 ogg_int64_t; +typedef int32 ogg_int32_t; +typedef uint32 ogg_uint32_t; +typedef int16 ogg_int16_t; Added: tiki/nds/include/pch.h =================================================================== --- tiki/nds/include/pch.h (rev 0) +++ tiki/nds/include/pch.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,25 @@ +/* + Tiki + + pch.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +// This is mainly just a placeholder on non-Win32 platforms. If we don't +// include a file at the top of every source file, Visual C++ is too stupid +// to do it on its own. It's a convenient excuse to predefine some other +// stuff too though. + +// This header does most of the useful work for bringing in stuff. +#include "Tiki/tiki.h" + +// Don't bother with namespace poo inside the framework itself. +using namespace Tiki; + +// Packed structs need some compiler-specific foo. +#define PACKED_STRUCT_BEGIN +#define PACKED_STRUCT_END +#define PACKED_STRUCT_MEMBER __attribute__((packed)) + + Property changes on: tiki/nds/include/pch.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/Makefile =================================================================== --- tiki/nds/src/Makefile (rev 0) +++ tiki/nds/src/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,12 @@ + +OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) + +all: $(OBJS) + $(AR) ru ../libtiki.a $(OBJS) + +clean: + -rm -f $(OBJS) + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/../../ +include ../Makefile.rules Property changes on: tiki/nds/src/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/init_shutdown.cpp =================================================================== --- tiki/nds/src/init_shutdown.cpp (rev 0) +++ tiki/nds/src/init_shutdown.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,35 @@ +/* + Tiki + + init_shutdown.cpp + + Copyright (C)2005 Atani Software +*/ + +#include "pch.h" + +#include "Tiki/sound.h" +#include "Tiki/stream.h" +#include "Tiki/plxcompat.h" +#include "Tiki/hid.h" + +namespace Tiki { + +bool init(int argc, char **argv) { + return Hid::init(); +} + +void shutdown() { + Hid::shutdown(); +} + +void setName(const char *windowName, const char *iconName) +{ +} + +namespace GL { +void showCursor(bool visible) { +} +} + +} Property changes on: tiki/nds/src/init_shutdown.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platgl.cpp =================================================================== --- tiki/nds/src/platgl.cpp (rev 0) +++ tiki/nds/src/platgl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,55 @@ +/* + * platgl.cpp + * Tiki + * + * Created by Dan Potter on 3/20/05. + * Copyright 2005 Cryptic Allusion, LLC. All rights reserved. + * + */ + +#include "Tiki/gl.h" +#include "Tiki/tikitime.h" +#include "Tiki/debug.h" + +#include <unistd.h> +#include <sys/time.h> + +namespace Tiki { +namespace GL { +namespace Frame { + +float getFrameRate() { + return 0.0f; +} + +void setFrameRateLimit(int rate) { +} + +} + +extern "C" { + +void tiki_wait_if_needed() { +} + +void tiki_scene_begin_hook() { +} + +void tiki_scene_finish_hook() { +} + +void tiki_scene_begin_opaque_hook() { +} + +void tiki_scene_finish_opaque_hook() { +} + +void tiki_scene_begin_trans_hook() { +} + +void tiki_scene_finish_trans_hook() { +} + +} +} +} Property changes on: tiki/nds/src/platgl.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/plathid.cpp =================================================================== --- tiki/nds/src/plathid.cpp (rev 0) +++ tiki/nds/src/plathid.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,22 @@ +#include "pch.h" +#include "Tiki/glhdrs.h" +#include "Tiki/hid.h" + +namespace Tiki { +namespace Hid { +bool platInit() { + return true; +} + +void platShutdown() { +} + +} + +} + +extern "C" void TikiRecvQuit() { + Tiki::Hid::Event evt(Tiki::Hid::Event::EvtQuit); + sendEvent(evt); +} + Property changes on: tiki/nds/src/plathid.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platthread.cpp =================================================================== --- tiki/nds/src/platthread.cpp (rev 0) +++ tiki/nds/src/platthread.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,92 @@ +/* + Tiki + + platthread.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/thread.h" + +#include <sys/time.h> +#include <time.h> + +using Tiki::Thread::thread_t; +using Tiki::Thread::mutex_t; +using Tiki::Thread::cond_t; + +bool Thread::create(thread_t * out, void * (*func)(void *), void * param) { + return false; +} + +bool Thread::join(thread_t thd, void ** out) { + return false; +} + +void Thread::exit(void * ptr) { +} + +bool Thread::equal(thread_t t1, thread_t t2) { + return false; +} + +thread_t Thread::self() { + return NULL; +} + + +bool Thread::mutex_create(mutex_t * out) { + return false; +} + +bool Thread::mutex_destroy(mutex_t * m) { + return false; +} + +bool Thread::mutex_trylock(mutex_t * m) { + return false; +} + +bool Thread::mutex_lock(mutex_t * m) { + return false; +} + +bool Thread::mutex_unlock(mutex_t * m) { + return false; +} + + +bool Thread::cond_broadcast(cond_t *cond) { + return false; +} + +bool Thread::cond_destroy(cond_t *cond) { + return false; +} + +bool Thread::cond_create(cond_t *cond) { + return false; +} + +bool Thread::cond_signal(cond_t *cond) { + return false; +} + +bool Thread::cond_wait(cond_t *cond, mutex_t *mutex, uint64 maxWaitMicros) { + return false; +} + +bool Thread::cond_wait(cond_t * cond, mutex_t *mutex) { + return false; +} + + + + + + + + + + Property changes on: tiki/nds/src/platthread.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/tikitime.cpp =================================================================== --- tiki/nds/src/tikitime.cpp (rev 0) +++ tiki/nds/src/tikitime.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,41 @@ +/* + Tiki + + tikitime.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/tikitime.h" + +#include <sys/time.h> +#include <unistd.h> + +namespace Tiki { +namespace Time { +uint64 gettime() { + timeval tv; + gettimeofday(&tv, NULL); + + uint64 rv = tv.tv_sec; rv *= 1000000; + rv += tv.tv_usec; + + return rv; +} + +void sleep(uint64 us) { +// TODO: add this +} + +} +} + + + + + + + + + Property changes on: tiki/nds/src/tikitime.cpp ___________________________________________________________________ Name: svn:executable + * Modified: tiki/src/gl/drawables/console.cpp =================================================================== --- tiki/src/gl/drawables/console.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/drawables/console.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,7 +36,7 @@ m_texture->select(); -#if TIKI_PLAT != TIKI_DC +#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 @@ -262,8 +262,10 @@ int x=0,y=0; float x_step=(m_w / m_cols); 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++) { Modified: tiki/src/gl/genmenu.cpp =================================================================== --- tiki/src/gl/genmenu.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/genmenu.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -134,10 +134,24 @@ Frame::begin(); - if (m_exiting) + if (m_exiting) { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0]*m_exitCount, m_bg[1]*m_exitCount, m_bg[2]*m_exitCount, 1.0f); - else +#else + glClearColor((uint8)((m_bg[0]*m_exitCount)*255), + (uint8)((m_bg[1]*m_exitCount)*255), + (uint8)((m_bg[2]*m_exitCount)*255)); +#endif + } + else { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0], m_bg[1], m_bg[2], 1.0f); +#else + glClearColor((uint8)(m_bg[0]*255), + (uint8)(m_bg[1]*255), + (uint8)(m_bg[2]*255)); +#endif + } visualOpaqueList(); Modified: tiki/src/gl/gl.cpp =================================================================== --- tiki/src/gl/gl.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/gl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -22,6 +22,7 @@ // This sets up an OpenGL environment approximately the same // as a PVR. +#if TIKI_PLAT != TIKI_NDS glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); #if TIKI_PLAT != TIKI_DC //KGL doesn't have these constants @@ -37,11 +38,14 @@ glShadeModel(GL_SMOOTH); glDisable(GL_CULL_FACE); +#endif set2d(); // glViewport((GLsizei)m_x1, (GLsizei)m_y1, (GLsizei)m_x2, (GLsizei)m_y2); + +#if TIKI_PLAT != TIKI_NDS glViewport(0, 0, 640, 480); - + glClearDepth(0.0f); #if TIKI_PLAT != TIKI_DC glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT+GL_STENCIL_BUFFER_BIT); @@ -49,6 +53,13 @@ glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT); #endif +#else // TIKI_NDS + glViewPort(0, 0, 255, 191); + + glClearDepth(0x7FFFF); + glClearColor(0,0,0); +#endif + glLoadIdentity(); transDisable(); @@ -75,7 +86,9 @@ void Frame::transEnable() { // This will leave the depth testing enabled (to not overdraw // opaque objects) but not update the depth buffer. +#if TIKI_PLAT != TIKI_NDS glDepthMask(GL_FALSE); +#endif #if TIKI_PLAT == TIKI_DC glKosFinishList(); @@ -83,7 +96,9 @@ // Turn on blending with a sensible alpha function default. glEnable(GL_BLEND); +#if TIKI_PLAT != TIKI_NDS glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif } void Frame::transDisable() { Modified: tiki/src/gl/plxcompat.cpp =================================================================== --- tiki/src/gl/plxcompat.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/plxcompat.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,12 +36,16 @@ } void Plxcompat::plx_cxt_blending(int src, int dst) { +#if TIKI_PLAT != TIKI_NDS glBlendFunc(src, dst); +#endif } void Plxcompat::plx_cxt_culling(int type) { +#if TIKI_PLAT != TIKI_NDS glCullFace(type); glFrontFace(GL_CCW); +#endif } ///////////////////////////////////////////////////////////////////// Modified: tiki/src/gl/texture.cpp =================================================================== --- tiki/src/gl/texture.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/texture.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -55,8 +55,10 @@ //glDeleteTexture frees the PVR memory for us, how nice of it! #endif m_txrdata = NULL; +#if TIKI_PLAT != TIKI_NDS if (!initial && m_gltxr) glDeleteTextures(1, &m_gltxr); +#endif m_gltxr = 0; } @@ -186,11 +188,13 @@ m_h = img->h; m_fmt = (Fmt)(img->fmt); switch(img->fmt) { + case Image::RGB565: + case Image::RGB888: +#if TIKI_PLAT != TIKI_NDS // NDS doesnt support Alpha? case Image::RGBA8888: - case Image::RGB565: case Image::ARGB4444: case Image::ARGB1555: - case Image::RGB888: +#endif break; default: /* shrug */ @@ -203,7 +207,7 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS /* We'll write the converted data into this buffer */ if (!m_txrdata) m_txrdata = new uint8[img->w * img->h * 4]; @@ -214,7 +218,7 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); GLenum err = glGetError(); -#else +#elif TIKI_PLAT == TIKI_DC m_txrdata = (uint8 *)pvr_mem_malloc(img->w * img->h * 2); pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, PVR_TXRLOAD_16BPP); @@ -224,6 +228,8 @@ glKosTex2D(GL_RGB565_TWID, m_w, m_h, m_txrdata); } glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS + glTexImage2D(0, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); #endif return true; @@ -234,11 +240,13 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC //KGL doesn't support these +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS + //KGL/NDS do support these glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -#else +#elif TIKI_PLAT == TIKI_DC glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS #endif m_w = w; @@ -281,7 +289,7 @@ void Texture::setFilter(FilterType filter) { -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS select(); GLuint glfilt = GL_LINEAR; switch (filter) { @@ -298,6 +306,7 @@ } void Texture::setUVClamp(UVMode umode, UVMode vmode) { +#if TIKI_PLAT != TIKI_NDS GLenum gumode, gvmode; gumode = umode == UVClamp ? GL_CLAMP : GL_REPEAT; @@ -314,6 +323,7 @@ if (gvmode == GL_CLAMP) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #endif +#endif } void * Texture::canvasLock() { @@ -324,18 +334,24 @@ convertToGl(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); #else switch (m_fmt) { +#if TIKI_PLAT != TIKI_NDS case ARGB1555: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB1555, m_w, m_h, 0, GL_ARGB1555, GL_UNSIGNED_BYTE, m_ptr); break; case ARGB4444: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, m_w, m_h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, m_ptr); break; +#endif case RGB565: +#if TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m_w, m_h, 0, GL_RGB565, GL_UNSIGNED_BYTE, m_ptr); +#else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); +#endif break; default: Debug::printf("Texture::canvasUnlock: Unsupported texture format\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |