Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a number of primitive objects #8578

Closed
wants to merge 1 commit into from

Conversation

BastiaanOlij
Copy link
Contributor

This PR adds a number of new 3D objects to the node tree. Each object is generated by code in a similar fashion as the TestCube and Quad objects are.

They differ in a number of ways:

  • UV coordinates ensure no overlapping on the surfaces
  • Mapping contains tangent information so normal maps can be used
  • Each object can be subdivided, this allows for vertex shaders to be used to further modify the objects.

Here is a test project that showcases the new objects:
https://github.com/BastiaanOlij/TestPrimitives

@BastiaanOlij
Copy link
Contributor Author

I'm planning to do a few more objects if I find the time. Also I don't know how to change the icons in the node editor, they are all the default geometry icons..

@reduz
Copy link
Member

reduz commented Apr 29, 2017 via email

@BastiaanOlij
Copy link
Contributor Author

@reduz , I would recommend anyone to make their assets in modeler software, this is handy to put some placeholder stuff in, not to build an entire game with (though it is possible) :)

I just got very tired switching back to Blender which is the only thing that works on my Mac and only so so because Macs were designed with one button mouses, grumble at supporting two, and hate anything designed with 3, so for simply stuff it can be very handy to just have it generate right there :)

Anyway, it's there, it's small, I'll add a few more things in. If you guys like it and find it useful, add it in, if not, I'll do a GDNative version for it in Godot 3 :)

@BastiaanOlij
Copy link
Contributor Author

@reduz , do keep in mind that you can't change the segments/subdivision of premade meshes, that is another issue.. though it may be interesting to look into adding a subdivider or mesh optimiser into Godot. UE4 for instance will take a high level mesh and optimise it automatically to create a number of LOD versions of the mesh. I once watched a video with some amazement of a guy making a zillion poly rock in z-brush, import it into UE4, used a few dozen instance of that object to create a rock face, and wonder how the....... that didn't drop the framerate like crazy. Seems that rock was automatically optimized to a version with lots less polygons...

Entirely different topic then this offcourse :)

@akien-mga
Copy link
Member

@BastiaanOlij Build fails on X11 and Windows:

g++ -o bin/godot.x11.tools.64 -pipe platform/x11/godot_x11.x11.tools.64.o platform/x11/context_gl_x11.x11.tools.64.o platform/x11/os_x11.x11.tools.64.o platform/x11/key_mapping_x11.x11.tools.64.o platform/x11/joystick_linux.x11.tools.64.o main/libmain.x11.tools.64.a main/tests/libtests.x11.tools.64.a modules/libmodules.x11.tools.64.a drivers/libdrivers.x11.tools.64.a editor/libeditor.x11.tools.64.a scene/libscene.x11.tools.64.a servers/libservers.x11.tools.64.a core/libcore.x11.tools.64.a -lX11 -lXinerama -lXcursor -lXrandr -lssl -lcrypto -lfreetype -lpng12 -lasound -lz -lGL -lpthread -ldl
modules/libmodules.x11.tools.64.a(register_module_types.x11.tools.64.o): In function `register_module_types()':
/home/travis/build/godotengine/godot/modules/register_module_types.cpp:89: undefined reference to `register_primitives_types()'
modules/libmodules.x11.tools.64.a(register_module_types.x11.tools.64.o): In function `unregister_module_types()':
/home/travis/build/godotengine/godot/modules/register_module_types.cpp:158: undefined reference to `unregister_primitives_types()'

@BastiaanOlij
Copy link
Contributor Author

BastiaanOlij commented May 2, 2017

@akien-mga , I'll have a look on Windows in the weekend, I'm hoping to add a few more shapes then as well. Strange errors though, thats the register and unregister functions it is complaining amount (the ones in https://github.com/BastiaanOlij/godot/blob/primitives/modules/primitives/register_types.cpp), that doesn't make much sense.

edit could it be as simple as the last line in SCsub needing newline at the end? or that it is missing something else that prevents the files from being included?


ObjectTypeDB::register_type<Cube3D>();
ObjectTypeDB::register_type<Sphere3D>();
ObjectTypeDB::register_type<Prism3D>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation issue ;)

@akien-mga
Copy link
Member

edit could it be as simple as the last line in SCsub needing newline at the end? or that it is missing something else that prevents the files from being included?

That should be fixed for the sake of prettiness, but the actual issue might be that you named the file SCSub and not SCsub (case issue).
See https://github.com/godotengine/godot/blob/master/modules/SCsub#L19

@akien-mga
Copy link
Member

BTW the files don't strictly follow the clang-format style, Travis did not complain because it seems to be confused by PRs on the 2.1 branch.

@BastiaanOlij
Copy link
Contributor Author

@akien-mga hehe, case, lovely, I'll get it fixed up tomorrow. I got my branch currently switched to my stereo_camera as I'm working on my videos..

Whats the command for applying the clang formatting to the files?

@akien-mga
Copy link
Member

Whats the command for applying the clang formatting to the files?

If you have the clang-format binary in your $PATH, it should be:

clang-format -i -style=file <path/to/files>

(the "file" in style=file is the actual "file" word, not a path to a file)

I haven't tested them on macOS, but you should be able to setup the precommit hooks that we have in misc/hooks. There are setup instructions in the readme, you might have to tweak things a bit for it to work in the macOS shell - if so I'd be interested in fixes that would make them work out of the box on Linux shells and macOS shells.

@reduz
Copy link
Member

reduz commented May 2, 2017 via email

@reduz
Copy link
Member

reduz commented May 2, 2017 via email

@BastiaanOlij
Copy link
Contributor Author

@reduz , Ah I get it now, you mean turn them into resources, I had some issues with that in Godot 2 and actually using them but that is probably me not having learned a trick.

Yeah its probably a good idea to change them into resources, I thought you meant actually putting fixed models in there which defies the point a little :)

@SirPigeonz
Copy link
Contributor

SirPigeonz commented May 3, 2017

@BastiaanOlij @reduz

That would be great.
Real meshes make other Godot features work and can be used like real assets.
Generated meshes make stuff procedural and more powerful for level prototyping and temp visualizations.

Ideal solution would be when we could generate procedural meshes and save them as mesh resources and even export to OBJ/FBX/DAE so Level Artists could use it as reference in their 3D software of choice.
See issue - #8510
Level Designers almost always must work in Game Editor and forcing them to create meshes blindly in 3D package and export stuff to Godot is "no go" workflow.

@reduz
Copy link
Member

reduz commented May 3, 2017 via email

@eon-s
Copy link
Contributor

eon-s commented May 5, 2017

Yes, meshes is better because it will improve other things like Particles creation.

@reduz
Copy link
Member

reduz commented Jun 7, 2017

Alright, finally Mesh and ArrayMesh have been decoupled. Feel free to rework your PR so you can directly inherit from Mesh! Also, i think it does not need to be a module, should be good in core, so put it in scene/resources

@BastiaanOlij
Copy link
Contributor Author

Will do @reduz, I'll try and find some time tonight, else this will be my Saturday morning project.

@BastiaanOlij
Copy link
Contributor Author

@reduz btw this is the 2.1 branch :)

@akien-mga we should probably close this as I'm not planning to do any more here, all work will go into #8661

@SirPigeonz
Copy link
Contributor

@BastiaanOlij You can close your own requests :)
There should be a button next to Comment. Called Comment and Close.

@BastiaanOlij
Copy link
Contributor Author

@n-pigeon I know, I just don't like closing things off too quickly :)

@akien-mga akien-mga modified the milestones: 2.1, 3.0 Jun 10, 2017
@BastiaanOlij BastiaanOlij deleted the primitives branch December 1, 2018 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants