@ -47,6 +47,33 @@ class GlConstantTransformer : Transformer() {
} else {
} else {
transformArguments ( unit )
transformArguments ( unit )
}
}
transformFramebufferStatus ( unit )
}
private fun transformFramebufferStatus ( unit : CompilationUnit ) {
unit . walk { expr : BinaryExpr ->
if ( expr . operator == BinaryExpr . Operator . EQUALS || expr . operator == BinaryExpr . Operator . NOT _EQUALS ) {
transformFramebufferStatus ( unit , expr . left )
transformFramebufferStatus ( unit , expr . right )
}
}
}
private fun transformFramebufferStatus ( unit : CompilationUnit , expr : Expression ) {
if ( ! expr . isIntegerLiteralExpr ) {
return
}
val value = expr . asIntegerLiteralExpr ( ) . checkedAsInt ( )
if ( value . toLong ( ) != GL _FRAMEBUFFER _COMPLETE . value ) {
return
}
unit . addImport ( GL _CLASS )
enums += GL _FRAMEBUFFER _COMPLETE
expr . replace ( GL _FRAMEBUFFER _COMPLETE . toExpr ( ) )
}
}
private fun transformParameterNames ( type : TypeDeclaration < * > ) {
private fun transformParameterNames ( type : TypeDeclaration < * > ) {
@ -287,6 +314,7 @@ class GlConstantTransformer : Transformer() {
private const val JAGGL _CLASS = " jaggl.opengl "
private const val JAGGL _CLASS = " jaggl.opengl "
private val GL _CLASSES = setOf ( GL _CLASS , JAGGL _CLASS )
private val GL _CLASSES = setOf ( GL _CLASS , JAGGL _CLASS )
private val REGISTRY = GlRegistry . parse ( )
private val REGISTRY = GlRegistry . parse ( )
private val GL _FRAMEBUFFER _COMPLETE = GlEnum ( " GL_FRAMEBUFFER_COMPLETE " , 0x8CD5 )
private val FIELD _METHOD _COMPARATOR = Comparator < BodyDeclaration < * > > { a , b ->
private val FIELD _METHOD _COMPARATOR = Comparator < BodyDeclaration < * > > { a , b ->
when {
when {