More efficient code, less compiler warnings.
// Tell the GUI this is no ordinary object, but an image
json.writeStringMember("__class__", "image");
// Tell the GUI this is no ordinary object, but an image
json.writeStringMember("__class__", "image");
- json.writeNumberMember("__width__", desc.width);
- json.writeNumberMember("__height__", desc.height);
- json.writeNumberMember("__depth__", desc.depth);
+ json.writeIntMember("__width__", desc.width);
+ json.writeIntMember("__height__", desc.height);
+ json.writeIntMember("__depth__", desc.depth);
json.writeStringMember("__format__", formatToString(desc.internalFormat));
json.writeStringMember("__format__", formatToString(desc.internalFormat));
// texture internal format
json.writeStringMember("__type__", "uint8");
json.writeBoolMember("__normalized__", true);
// texture internal format
json.writeStringMember("__type__", "uint8");
json.writeBoolMember("__normalized__", true);
- json.writeNumberMember("__channels__", channels);
+ json.writeIntMember("__channels__", channels);
GLubyte *pixels = new GLubyte[desc.depth*desc.width*desc.height*channels];
GLubyte *pixels = new GLubyte[desc.depth*desc.width*desc.height*channels];
// Tell the GUI this is no ordinary object, but an image
json.writeStringMember("__class__", "image");
// Tell the GUI this is no ordinary object, but an image
json.writeStringMember("__class__", "image");
- json.writeNumberMember("__width__", width);
- json.writeNumberMember("__height__", height);
- json.writeNumberMember("__depth__", 1);
+ json.writeIntMember("__width__", width);
+ json.writeIntMember("__height__", height);
+ json.writeIntMember("__depth__", 1);
json.writeStringMember("__format__", formatToString(internalFormat));
json.writeStringMember("__format__", formatToString(internalFormat));
// texture internal format
json.writeStringMember("__type__", "uint8");
json.writeBoolMember("__normalized__", true);
// texture internal format
json.writeStringMember("__type__", "uint8");
json.writeBoolMember("__normalized__", true);
- json.writeNumberMember("__channels__", channels);
+ json.writeIntMember("__channels__", channels);
GLenum type = GL_UNSIGNED_BYTE;
GLenum type = GL_UNSIGNED_BYTE;
def visitLiteral(self, literal, instance):
if literal.kind == 'Bool':
print ' json.writeBool(%s);' % instance
def visitLiteral(self, literal, instance):
if literal.kind == 'Bool':
print ' json.writeBool(%s);' % instance
- elif literal.kind in ('SInt', 'Uint', 'Float', 'Double'):
- print ' json.writeNumber(%s);' % instance
+ elif literal.kind in ('SInt', 'Uint'):
+ print ' json.writeInt(%s);' % instance
+ elif literal.kind in ('Float', 'Double'):
+ print ' json.writeFloat(%s);' % instance
else:
raise NotImplementedError
else:
raise NotImplementedError
print ' dumpEnum(json, %s);' % instance
else:
assert False
print ' dumpEnum(json, %s);' % instance
else:
assert False
- print ' json.writeNumber(%s);' % instance
+ print ' json.writeInt(%s);' % instance
def visitBitmask(self, bitmask, instance):
raise NotImplementedError
def visitBitmask(self, bitmask, instance):
raise NotImplementedError
self.visit(alias.type, instance)
def visitOpaque(self, opaque, instance):
self.visit(alias.type, instance)
def visitOpaque(self, opaque, instance):
- print ' json.writeNumber((size_t)%s);' % instance
+ print ' json.writeInt((size_t)%s);' % instance
print ' json.writeString("GL_TRUE");'
print ' break;'
print ' default:'
print ' json.writeString("GL_TRUE");'
print ' break;'
print ' default:'
- print ' json.writeNumber(static_cast<GLint>(value));'
+ print ' json.writeInt(static_cast<GLint>(value));'
print ' break;'
print ' }'
print '}'
print ' break;'
print ' }'
print '}'
print ' if (s) {'
print ' json.writeString(s);'
print ' } else {'
print ' if (s) {'
print ' json.writeString(s);'
print ' } else {'
- print ' json.writeNumber(pname);'
+ print ' json.writeInt(pname);'
print ' }'
print '}'
print
print ' }'
print '}'
print
print ' json.endMember();'
print ' binding = 0;'
print ' glGetIntegerv(%s, &binding);' % binding
print ' json.endMember();'
print ' binding = 0;'
print ' glGetIntegerv(%s, &binding);' % binding
- print ' json.writeNumberMember("%s", binding);' % binding
+ print ' json.writeIntMember("%s", binding);' % binding
print ' if (enabled || binding) {'
print ' json.beginMember("%s");' % target
print ' json.beginObject();'
print ' if (enabled || binding) {'
print ' json.beginMember("%s");' % target
print ' json.beginObject();'
switch (elemType) {
case GL_FLOAT:
switch (elemType) {
case GL_FLOAT:
- json.writeNumber(*u.fvalue);
+ json.writeFloat(*u.fvalue);
- json.writeNumber(*u.dvalue);
+ json.writeFloat(*u.dvalue);
- json.writeNumber(*u.ivalue);
+ json.writeInt(*u.ivalue);
break;
case GL_UNSIGNED_INT:
break;
case GL_UNSIGNED_INT:
- json.writeNumber(*u.uivalue);
+ json.writeInt(*u.uivalue);
break;
case GL_BOOL:
json.writeBool(*u.uivalue);
break;
case GL_BOOL:
json.writeBool(*u.uivalue);
json.beginMember(name);
json.beginArray();
json.beginMember(name);
json.beginArray();
- json.writeNumber(params[0]);
- json.writeNumber(params[1]);
- json.writeNumber(params[2]);
- json.writeNumber(params[3]);
+ json.writeFloat(params[0]);
+ json.writeFloat(params[1]);
+ json.writeFloat(params[2]);
+ json.writeFloat(params[3]);
json.endArray();
json.endMember();
}
json.endArray();
json.endMember();
}
json.beginMember(name);
json.beginArray();
json.beginMember(name);
json.beginArray();
- json.writeNumber(params[0]);
- json.writeNumber(params[1]);
- json.writeNumber(params[2]);
- json.writeNumber(params[3]);
+ json.writeFloat(params[0]);
+ json.writeFloat(params[1]);
+ json.writeFloat(params[2]);
+ json.writeFloat(params[3]);
json.endArray();
json.endMember();
}
json.endArray();
json.endMember();
}
* Special case for char to prevent it to be written as a literal
* character.
*/
* Special case for char to prevent it to be written as a literal
* character.
*/
- inline void writeNumber(char n) {
+ inline void writeInt(signed char n) {
separator();
os << std::dec << static_cast<int>(n);
value = true;
space = ' ';
}
separator();
os << std::dec << static_cast<int>(n);
value = true;
space = ' ';
}
- inline void writeNumber(unsigned char n) {
+ inline void writeInt(unsigned char n) {
separator();
os << std::dec << static_cast<unsigned>(n);
value = true;
separator();
os << std::dec << static_cast<unsigned>(n);
value = true;
- inline void writeNumber(T n) {
+ inline void writeInt(T n) {
+ separator();
+ os << std::dec << n;
+ value = true;
+ space = ' ';
+ }
+ template<class T>
+ inline void writeFloat(T n) {
separator();
if (isnan(n)) {
// NaN is non-standard but widely supported
separator();
if (isnan(n)) {
// NaN is non-standard but widely supported
- inline void writeNumberMember(const char *name, T n) {
+ inline void writeIntMember(const char *name, T n) {