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

Add creating a line to class Builder #666

Closed
wants to merge 1 commit into from

Conversation

rhabacker
Copy link
Contributor

@rhabacker rhabacker commented Dec 16, 2022

Description

The commit from this merge request add a method to the class vsg::Builder to draw a line similar to the other available primitives.

Fixes vsg-dev/osg2vsg#63 (partial)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Compiled vsgbuilder from the vsgExample project after added drawing line support

Test Configuration:

  • Hardware: GTX-1070
  • Toolchain: g++ 7
  • SDK: Vulkan 1.3.231

Checklist:

@robertosfield
Copy link
Collaborator

I'm rather lost why a building a line segment is of value from vsg::Builder. It's really heavy way to implement the drawing of single line segment, and really not what I'd want any VSG user to be doing as it's just so inefficient.

What is the purpose here?

@robertosfield
Copy link
Collaborator

I have reflected on the need for generating lines and I think the right approach is to passing in a complete vsg::vec3Array or possibly a list of vsg::vec3Array to generate lines for. Creating primitives mesh might also be something you'd want to do in this way. Perhaps it could all be just done together.

I am going to close this PR as I just don't feel it's useful for real world applications. If we want an API to make it lines and mesh geometries more easily then vsg::Builder might be a starting place, but to brain storm what this might be I think a Discussion thread would be the right place to do this.

@rhabacker
Copy link
Contributor Author

rhabacker commented Jan 30, 2023

I have reflected on the need for generating lines and I think the right approach is to passing in a complete vsg::vec3Array or possibly a list of vsg::vec3Array to generate lines for.

This means that when drawing lines it is necessary that

  1. geometryInfo gets an additional member for setting vertices, which contains the points for the lines
  2. since there is currently no explicit way in the StateInfo class to set the topology of the GraphicPipeline, it is necessary to enable the wireframe in the vsg::StateInfo instance to display lines.
  3. Rename to createLines() as it could create more than one line

Or is there more to do ?

@rhabacker
Copy link
Contributor Author

Or is there more to do ?

What about normals and texture coordinates? When you create a line, they are calculated in createLine(), but if you use more than one line, I assume they have to be specified as well. Or can they be calculated completely in createLines() too ?

@robertosfield
Copy link
Collaborator

All good questions, that I don't yet have quick answers to, I will need to sit down and ponder on the issue.

vsg::Bulder was written specifically for primitives shapes like cubes, sphere etc, rather than free form meshes/points/lights so the StateInfo/GeometryInfo start creaking at the seams when we start trying to generalize them to this more general purpose.

It may be that we need to have two builder classes - one for shapes, and one for free forms geometry setup. I need time to think about the topic though.

@rhabacker
Copy link
Contributor Author

rhabacker commented Feb 3, 2023

It may be that we need to have two builder classes - one for shapes, and one for free forms geometry setup. I need time to think about the topic though.

Vulkan specifies several primitive types. Perhaps an additional PrimitiveBuilder or BuilderPrimitive class would fit.

@rhabacker
Copy link
Contributor Author

Vulkan specifies several primitive types. Perhaps an additional PrimitiveBuilder class would fit.

geometryInfo gets an additional member for setting vertices, which contains the points for the lines

May be PrimitiveGeometryInfo or GeometryInfoPrimitive ?

since there is currently no explicit way in the StateInfo class to set the topology of the GraphicPipeline

PrimitiveStateInfo or StateInfoPrimitive ?

@rhabacker
Copy link
Contributor Author

It may be that we need to have two builder classes - one for shapes, and one for free forms geometry setup. I need time to think about the topic though.

Vulkan specifies several primitive types. Perhaps an additional PrimitiveBuilder or BuilderPrimitive class would fit.

I see a current use for such a class in osg2vsg to avoid multiple implementations when converting osg geometry to vsg, since the necessary steps are basically the same.

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.

3d scene does not show lines and texts compared with osg
2 participants