Giter Site home page Giter Site logo

jujuadams / dotobj Goto Github PK

View Code? Open in Web Editor NEW
40.0 4.0 5.0 115.68 MB

.obj/.mtl loader, written in native GML, for GameMaker LTS 2022

License: MIT License

Game Maker Language 64.21% GLSL 1.14% Yacc 34.65%
gamemaker gamemaker-studio-2 gms2 3d obj model gml

dotobj's Introduction

dotobj 5.5.0

.obj/.mtl loader, written in native GML, for GameMaker LTS 2022 by Juju Adams

Download the .yymps

See also BBMOD by Patrik Kraif

 

Lightweight .obj/.mtl 3D model loader written in native GML. Can load from external files or from buffers. This example does not show off complex renderering or PBR, it only demonstrates the loading capabilities of the library.

Details on the .obj format can be found here: http://paulbourke.net/dataformats/obj/

 

Look! It's Sponza! In GameMaker!

 

dotobj currently supports:

  1. Per vertex position, texture coordinates, and normals

  2. Materials and material libraries

  3. Groups and objects

  4. Vertex colours - (not in the official .obj spec, but some editors can export them)

  5. UV flipping and winding-order reversal to handle engine quirks

  6. N-gon faces

 

How do I import dotobj into my game?

GameMaker allows you to import assets, including scripts and shaders, directly into your project via the "Local Package" system. From the Releases tab for this repo, download the .yymps file for the latest version. In the GMS2 IDE, load up your project and click on "Tools" on the main window toolbar. Select "Import Local Package" from the drop-down menu then import all scripts from the package.

 

Please note that dotobj doesn't support the following features:

  1. Smoothing groups

Not a priority since you can usually bake normals on export, but it'd be useful to have regardless.

  1. Separate in-file LOD

Not sure how often this gets used. Probably possible to implement if requested.

  1. Line primitives

Line primitives are mostly used for visualisation in editors rather than for actual game rendering. It's possible to parse line primitives and output that, but it's not a priority.

  1. Freeform curve/surface geometry (NURBs/Bezier curves etc.)

Rare to see this in gamedev and getting GameMaker to generate surfaces is not going to be a pleasant process. This will probably never be implemented.

dotobj's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotobj's Issues

Cached dotobj file's AABB values are set to 0

If I load a raw dotobj through DotObjModelRawLoad() the AABB values seem to all be set to 0.

I tested it on the planetcachetest:

loading the model and doing GetAABB() before the cache is created displays the correct values, then if its cached file is loaded and I do GetAABB() on the cached model the values are 0.

Unable to get the dotobj example project to run on IDE Version 2.3.1.536 and Runtime 2.3.0.401

I'm running the master branch. https://github.com/JujuAdams/dotobj/tree/master
############################################################################################
ERROR in
action number 1
of Create Event
for object objTransformOnLoadTest:

unable to convert string "dotobj_group" to int64
at gml_Script_anon_DotobjClassGroup_gml_GlobalScript_DotobjClassGroup_2378_DotobjClassGroup_gml_GlobalScript_DotobjClassGroup (line 108) - _model.groups_struct[$ name] = self;
############################################################################################
gml_Script_anon_DotobjClassGroup_gml_GlobalScript_DotobjClassGroup_2378_DotobjClassGroup_gml_GlobalScript_DotobjClassGroup (line 108)
gml_Script_DotobjEnsureGroup (line 152) - AddTo(_model);
gml_Script_DotobjModelLoad (line 84) - var _group_struct = DotobjEnsureGroup(_model_struct, __DOTOBJ_DEFAULT_GROUP, 0);
gml_Script_DotobjModelLoadFile (line 31) - var _result = DotobjModelLoad(_buffer);
gml_Object_objTransformOnLoadTest_Create_0 (line 12) - model_planet = DotobjModelLoadFile("planet.obj");

Warning messages for comment lines if the first piece of data has multiple characters

The header of an OBJ file that was generated by Meshlab will start with comments about the file. For example:

####
#
# OBJ File Generated by Meshlab
#
####
# Object voronoi.obj
#
# Vertices: 763
# Faces: 88
#
####
mtllib ./voronoi.obj.mtl

The lines with #### are comments, although will be output as warning messages:

DotobjClassGroup(): Created group "__dotobj_group__"
DotobjModelLoad(): Warning! "####" is not recognised. (ln=1)
DotobjModelLoad(): Warning! "####" is not recognised. (ln=9)
DotobjModelLoad(): Warning! "####" is not recognised. (ln=21)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.