[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz] Libvob redesign: new vob definitions
From: |
Tuomas Lukka |
Subject: |
[Gzz] Libvob redesign: new vob definitions |
Date: |
Fri, 28 Feb 2003 14:34:54 +0200 |
User-agent: |
Mutt/1.4i |
This is something I think a number of people here will like: defining new Vobs
is now *easy*.
The following code defines a (ridiculous) vob:
struct LineConnectorTESTFLOAT {
enum { NTrans = 1 };
float foo;
int bar;
template<class F> void params(F &f) {
f(
foo,
bar
);
}
template<class T> void render(const T &t0) const {
glBegin(GL_LINES);
t0.vertex(Vob::ZPt(foo,0,0));
t0.vertex(Vob::ZPt(bar,1,1));
glEnd();
}
};
VOB_DEFINED(LineConnectorTESTFLOAT);
That's all. No code for parameters or anything. The clever bit is that
the JNI and Java codes are generated from the params() template function,
since there we have access to the type information (for the parameter types)
and, at runtime of the generated code, access to the actual fields by passing
a function that takes reference parameters.
The only things that need to be mentioned twice are 1) the names of the
structure
members, and 2) the name of the vob.
Tuomas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz] Libvob redesign: new vob definitions,
Tuomas Lukka <=