-
Notifications
You must be signed in to change notification settings - Fork 2
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
WorldTreeRenderer #538
WorldTreeRenderer #538
Conversation
crashing at aabbrenderer::clear when I press T, not sure why (this = stack seems corrupted) |
this method just clear a std::vector... can you uncomment its one line and print out this instead to see if we're working inside a valid object? |
fixed it |
Yes and no. What really is missing is m_initialized(false) in the WorldTreeRenderer constructors initializer list. AABBRenderer is an OpenGL-Dependant component and should be created lazy to keep tests save. |
ahh, I didn't read the code to the bottom :D |
please add your hotkey to doc/howto.md, will do the same for the flycam |
I take back my previous comment, the solution by @xchrdw is nearer to the truth than my proposed. AABBRenderer is a component written by us, it takes care of laziness itself. Updated howto as well. does this work for all of you now? |
m_voxelRenderer->afterDraw(); | ||
|
||
World::instance()->particleEngine().draw(camera); | ||
|
||
if (m_worldTreeRendererEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the worldTree gets rendered to the normalZ buffer. you should either draw correct normals or set the drawBuffers to Color or Color and Emissiveness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the glow effects on the lines so emissiveness could stay ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite get your first comment. Why am I rendering to the normalZ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you call
m_framebuffer->setDrawBuffers({ BufferNames::Color, BufferNames::NormalZ, BufferNames::Emissisiveness });
and render afterwards. The fragColor output gets copied to all of them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean because my shader doesn't explicitly write to location 1 and 2 the value from location 0 gets there automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. at least on my pc I see the lines in the normalz buffer. I think the best way is to call m_framebuffer->setDrawBuffers({ BufferNames::Color }); before rendering the grid. (maybe add emissiveness)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added dummy values to normalz (directly into the camera) and emissiveness.
I don't really want to hack around anything (=disabling drawbuffers) until we have discussed the structure of gameplayscene (see #537)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you consider setting different drawbuffers hacking around? I don't have a problem with debug info not getting written to some postprocessing buffers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it would mean that gameplayscene and the pp are tightly tied and cannot be divided from each other at some future point
vec4 color = vec4(0.3, 1.0, 0.3, 1.0); | ||
|
||
fragColor = color; | ||
normalz = vec4(0.0, 0.0, 1.0, 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentation for color and use gl_FragCoord.z for the normalz.w buffer. I think there should either be valid data or it should not be written to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which component of normalz should gl_FragCoord.z go to? x, y, z or w?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x,y,z is the normal, w is depth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah! normal AND Z buffer, not normalized Z buffer :D
/** | ||
Provides the geometry of a unit-cube | ||
Not that the lifetime of this class has to be >= the lifetime of the program/vao | ||
it is bound to, otherwise their behaviour is undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a note^^
looks good to me |
This draws all active leafs of the WorldTree as wireframes. Interesting to watch and (in combination with the flycam?) useful to debug and optimize the worldtree.
(De)Activate it by pressing T
Note that while I placed the WorldTreeRenderer inside the GamePlayScene, I'm not really sure if it belongs there. See #537