Skip to content

Converts OBJ models to wireframe vertex buffer files for Defold

License

Notifications You must be signed in to change notification settings

Wolfe2x7/Desolve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

utah_teapot

Desolve ('dissolve')

Run a copy of this script inside your project to convert a 3D model in OBJ format to Defold's mesh vertex buffer format, useful for wireframe rendering. It can also convert to a regular triangulated mesh. When creating a wireframe, faces do not have to be triangulated; quads and Ngons will be traced as they are.

Change the variables in the script to input your OBJ file and desired output filename.

When the process is complete, the extents of the OBJ model will be printed to the console, defining its AABB (axis-aligned bounding box). Copy and paste those values to a script to enable frustum culling for your new mesh, like this example:

function init(self)
	-- set AABB for mesh
	local res_path = go.get('#mesh', 'vertices')
	local buf = resource.get_buffer(res_path)
	buffer.set_metadata(buf, hash('AABB'), { -1, -1, -1, 1, 1, 1 }, buffer.VALUE_TYPE_FLOAT32)
	resource.set_buffer(res_path, buf)
end

Note: This script may not work with older/unusual OBJ formats.

box

About

Converts OBJ models to wireframe vertex buffer files for Defold

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published