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

WorldTreeRenderer #538

Merged
merged 13 commits into from
Apr 5, 2014
Merged

WorldTreeRenderer #538

merged 13 commits into from
Apr 5, 2014

Conversation

mrzzzrm
Copy link

@mrzzzrm mrzzzrm commented Mar 28, 2014

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

@psieg
Copy link
Contributor

psieg commented Mar 28, 2014

crashing at aabbrenderer::clear when I press T, not sure why (this = stack seems corrupted)

@mrzzzrm
Copy link
Author

mrzzzrm commented Mar 28, 2014

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?
(is the stack corrupted because you ran it in release mode?)

@xchrdw
Copy link
Member

xchrdw commented Mar 29, 2014

fixed it

@mrzzzrm
Copy link
Author

mrzzzrm commented Mar 29, 2014

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.

@xchrdw
Copy link
Member

xchrdw commented Mar 29, 2014

ahh, I didn't read the code to the bottom :D

@psieg
Copy link
Contributor

psieg commented Mar 29, 2014

please add your hotkey to doc/howto.md, will do the same for the flycam
Nice feature, always thought we should have things like that but other things were more important

@mrzzzrm
Copy link
Author

mrzzzrm commented Mar 29, 2014

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) {
Copy link
Member

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.

Copy link
Member

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 ;)

Copy link
Author

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?

Copy link
Member

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

Copy link
Author

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?

Copy link
Member

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)

Copy link
Author

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)

Copy link
Member

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.

Copy link
Author

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);
Copy link
Member

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.

Copy link
Author

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?

Copy link
Member

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

Copy link
Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

probably a note^^

@psieg
Copy link
Contributor

psieg commented Apr 1, 2014

looks good to me :shipit:

@xchrdw
Copy link
Member

xchrdw commented Apr 5, 2014

:shipit:

mrzzzrm pushed a commit that referenced this pull request Apr 5, 2014
@mrzzzrm mrzzzrm merged commit dcd40ae into master Apr 5, 2014
@mrzzzrm mrzzzrm deleted the worldtree_rendering branch April 5, 2014 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants