31 |
#include <vob/util/ObjectStorer.hxx> |
#include <vob/util/ObjectStorer.hxx> |
32 |
#include <vob/os/Os.hxx> |
#include <vob/os/Os.hxx> |
33 |
|
|
34 |
|
#include <vob/jni/Strings.hxx> |
35 |
|
|
36 |
namespace Vob { |
namespace Vob { |
37 |
namespace JNI { |
namespace JNI { |
38 |
|
|
46 |
*/ |
*/ |
47 |
template<class T> class JParameter ; |
template<class T> class JParameter ; |
48 |
|
|
49 |
|
typedef std::vector<GLubyte> ByteVector; |
50 |
|
|
51 |
extern ObjectStorer<Vob0> vob0s; |
extern ObjectStorer<Vob0> vob0s; |
52 |
extern ObjectStorer<Vob1> vob1s; |
extern ObjectStorer<Vob1> vob1s; |
53 |
extern ObjectStorer<Vob2> vob2s; |
extern ObjectStorer<Vob2> vob2s; |
54 |
extern ObjectStorer<Vob> vob3s; |
extern ObjectStorer<Vob> vob3s; |
55 |
extern ObjectStorer<Os::RenderingSurface> windows; |
extern ObjectStorer<Os::RenderingSurface> windows; |
56 |
|
extern ObjectStorer<ByteVector> bytevectors; |
57 |
|
|
58 |
#define START_VOB_JNI_CONVERSION(type, javaName_, jnitype_) \ |
#define START_VOB_JNI_CONVERSION(type, javaName_, jnitype_) \ |
59 |
struct JParameter<type> { \ |
struct JParameter<type> { \ |
92 |
out = in; \ |
out = in; \ |
93 |
END_VOB_JNI_CONVERSION |
END_VOB_JNI_CONVERSION |
94 |
|
|
95 |
#define VOB_JNI_CONVERSION_IDDED(type, javaName_) \ |
#define START_VOB_JNI_CONVERSION_IDDED(type, javaName_) \ |
96 |
struct JParameter<type> { \ |
struct JParameter<type> { \ |
97 |
typedef jint jniType; \ |
typedef jint jniType; \ |
98 |
static std::string javaParam(std::string paramPrefix) { \ |
static std::string javaParam(std::string paramPrefix) { \ |
119 |
static std::string jniStructCode(std::string paramPrefix) { \ |
static std::string jniStructCode(std::string paramPrefix) { \ |
120 |
return "_."+paramPrefix+"="+paramPrefix+";\n"; \ |
return "_."+paramPrefix+"="+paramPrefix+";\n"; \ |
121 |
} \ |
} \ |
122 |
static void convert(JNIEnv *env, jint &in, type &out) { \ |
static void convert(JNIEnv *env, jint &in, type &out) { |
|
out = type(in); \ |
|
|
}}; |
|
123 |
|
|
124 |
|
|
125 |
VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat) |
VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat) |
126 |
VOB_JNI_CONVERSION_ASSIGN(int, "int", jint) |
VOB_JNI_CONVERSION_ASSIGN(int, "int", jint) |
127 |
|
|
128 |
VOB_JNI_CONVERSION_IDDED(DisplayListID, "GL.DisplayList") |
START_VOB_JNI_CONVERSION(Token, "String", jstring) |
129 |
|
out = tokenFromJstring(env, in); |
130 |
|
END_VOB_JNI_CONVERSION |
131 |
|
|
132 |
|
|
133 |
|
START_VOB_JNI_CONVERSION_IDDED(GLubyte *, "GL.ByteVector") |
134 |
|
ByteVector *bv = bytevectors[in]; |
135 |
|
out = &((*bv)[0]); |
136 |
|
END_VOB_JNI_CONVERSION |
137 |
|
|
138 |
|
START_VOB_JNI_CONVERSION_IDDED(DisplayListID, "GL.DisplayList") |
139 |
|
out = in; |
140 |
|
END_VOB_JNI_CONVERSION |
141 |
|
|
142 |
} |
} |
143 |
} |
} |