VRML Editor

The goal of this activity proposed by our teacher was to create a simple 2D editor to exercise our expertise in VRML language.

So everything that was drawn in the editor, could be converted to VRML and rendered by compatible viewers.

We went a little further however, deciding instead to make a 3D editor, but nothing too advanced.

The result can be seen through some pictures below:

Through basic shapes such as box, cone, cylinder and sphere was possible to create more complex objects.

And then export to a file in text format with the corresponding VRML structure.

For example, this code was exported by our software VRML editor and then rendered by Cortona3D.

#VRML V2.0 utf8
# Centro Universitário Fundação Santo André
# Cameras
Viewpoint {
	description "Front (x/y)"
	fieldOfView 0.01
	orientation 0.00 1.00 0.00 0.000
	position 0.00 0.00 500.00
},
Viewpoint {
	description "Back (x/y)"
	fieldOfView 0.01
	orientation 0.00 -1.00 0.00 3.142
	position 0.00 0.00 -500.00
},
Viewpoint {
	description "Left (z/y)"
	fieldOfView 0.01
	orientation 0.00 -1.00 0.00 1.571
	position -500.00 0.00 0.00
},
Viewpoint {
	description "Right (z/y)"
	fieldOfView 0.01
	orientation 0.00 1.00 0.00 1.571
	position 500.00 0.00 0.00
},
Viewpoint {
	description "Top (x/z)"
	fieldOfView 0.01
	orientation -1.00 0.00 0.00 1.571
	position 0.00 500.00 0.00
},
Viewpoint {
	description "Bottom (x/z)"
	fieldOfView 0.01
	orientation 1.00 0.00 0.00 1.571
	position 0.00 -500.00 0.00
},
Viewpoint {
	description "Free"
	orientation -0.815 0.534 0.226 0.957
	position 3.00 6.00 5.00
}
# Box 1
Transform {
	translation 0.00 0.00 0.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Box {
			size 1.00 1.00 1.00
		}
		appearance Appearance {
			material Material {
				diffuseColor 1.00 0.00 0.00
				transparency 0.50
			}
		}
	}
}
# Sphere 2
Transform {
	translation 0.50 0.00 0.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Sphere {
			radius 0.50
		}
		appearance Appearance {
			material Material {
				diffuseColor 0.00 0.00 0.00
				transparency 0.00
			}
		}
	}
}
# Box 3
Transform {
	translation 0.00 -0.50 0.50
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Box {
			size 0.50 0.50 0.50
		}
		appearance Appearance {
			material Material {
				diffuseColor 0.00 1.00 0.00
				transparency 0.00
			}
		}
	}
}
# Cone 4
Transform {
	translation 0.00 0.00 -1.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Cone {
			bottomRadius 0.50
			height 1.00
		}
		appearance Appearance {
			material Material {
				diffuseColor 0.00 0.00 1.00
				transparency 0.00
			}
		}
	}
}
# Box 5
Transform {
	translation -2.00 0.00 0.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Box {
			size 1.00 1.00 1.00
		}
		appearance Appearance {
			material Material {
				diffuseColor 1.00 0.00 1.00
				transparency 0.50
			}
		}
	}
}
# Cone 6
Transform {
	translation -2.00 0.00 -1.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Cone {
			bottomRadius 0.50
			height 1.00
		}
		appearance Appearance {
			material Material {
				diffuseColor 1.00 1.00 0.00
				transparency 0.00
			}
		}
	}
}
# Cylinder 7
Transform {
	translation 2.00 0.00 0.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Cylinder {
			height 3.00
			radius 0.20
		}
		appearance Appearance {
			material Material {
				diffuseColor 0.40 0.20 0.00
				transparency 0.00
			}
		}
	}
}
# Cone 8
Transform {
	translation 2.00 1.00 0.00
	scale 1.00 1.00 1.00
	rotation 0.00 0.00 0.00 0.000
	children Shape {
		geometry Cone {
			bottomRadius 1.00
			height 2.00
		}
		appearance Appearance {
			material Material {
				diffuseColor 0.20 0.80 0.00
				transparency 0.00
			}
		}
	}
}
Cortona3D rendering the code on the left

Front viewpoint

Free viewpoint

Source code:
This source was written in Java language using NetBeans 7.x as IDE and the Libgdx framework to render the scene.
Additional libraries such as l2fprod-common were used to create the property editor.
This code was co-authored in collaboration with my classmate Guilherme Maganha Moreira.

Download:
We decided to release our source code under the MIT License.
The Libgdx framework is licensed under the Apache License, Version 2.0 and is included in binary form.
The l2fprod-common is also licensed under Apache License, Version 2.0 and is included in binary and source form with a few modifications.
The jcalendar and nachocalendar are dependencies of l2fprod-common and are licensed under the LGPLv2.1 and are include in binary form.
For more details, you can find the readme files and a copy of the licenses in the repository.

Source code is available at GitHub

If you find this useful or have any questions, we will be happy to help you.