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

[3D] add support for gl_clipdistance (part 1) #57899

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Commits on Jul 2, 2024

  1. qgsabstractmaterialsettings: Add mapSettings parameter to toMaterial

    This is not used at the moment. It will be used in the following
    commits to define the clip plane equations.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    268e2f9 View commit details
    Browse the repository at this point in the history
  2. qgsphongmaterialsettings: Use default vertex for the constant case

    There is no need to define a special vertex shader code for this
    material, it can use the default case. This way, it reduces the number
    of vertex shader files.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    bc19fab View commit details
    Browse the repository at this point in the history
  3. qgsmetalroughmaterial: Move add addDefinesToShaderCode to Qgs3DUtils

    This will be used by `QgsPhongMaterialSettings` in the next commit.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    7ea241f View commit details
    Browse the repository at this point in the history
  4. qgsphongmaterialsettings: Merge datadefined and constant cases

    This commit makes two changes to `QgsPhongMaterialSettings`:
    1. It merges `dataDefinedMaterial()` and `constantColorMaterial` into
    one new function: `buildMaterial`.
    
    2. The fragment shader files `phongDataDefined.frag` and
    `phongConstant.frag` are merged into a new file `phong.frag`. This is
    achieved by a `#define` logic. If `DATA_DEFINED` is defined, this is
    the dataDefined case. Otherwise, this is the constant case.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    87dad15 View commit details
    Browse the repository at this point in the history
  5. qgsgoochmaterialsettings: Merge datadefined and constant cases

    This is similar to the previous QgsPhongMaterialSettings change:
    
    This commit makes two changes to `QgsGoochMaterialSettings`:
    1. It merges `dataDefinedMaterial()` and `constantColorMaterial` into
    one new function: `buildMaterial`.
    
    2. There is one fragment shader file called `gooch.frag`. This is
    achieved by a `#define` logic. If `DATA_DEFINED` is defined, this is
    the dataDefined case. Otherwise, this is the constant case.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e6d7379 View commit details
    Browse the repository at this point in the history
  6. qgsphongtexturedmaterialsettings: Use default.vert vertex

    There is no need to define a special vertex shader code for this
    material, it can use the default case. This way, it reduces the number
    of vertex shader files.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e51eb79 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c1d16c1 View commit details
    Browse the repository at this point in the history
  8. 3d: Introduce QgsTextureMaterial

    This is the same material as the qt3d one:
    `Qt3DExtras::QTextureMaterial`. It will also be used in the following
    commits to define the gl_ClipDistance for the textured terrain.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    34e88e8 View commit details
    Browse the repository at this point in the history
  9. 3d: Introduce QgsDiffuseSpecularMaterial

    This is the same material as the qt3d one:
    `Qt3DExtras::QgsMaskedTexturedMaterial`. It will also be used in the
    following commits to define the gl_ClipDistance for the non texture
    case of the terrain.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    4be6e52 View commit details
    Browse the repository at this point in the history
  10. terrain: use QgsTextureMaterial and QgsDiffuseSpecularMaterial

    There is no functional change. It is simply needed to add
    gl_ClipDistance support to the terrain shaders in the next commits.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f48b6b4 View commit details
    Browse the repository at this point in the history
  11. qgsframegraph: Add clip planes

    `Qt3DRender::QClipPlane` enable OpenGL clipping plane that can be used
    in shaders using gl_ClipDistance.
    
    This change adds 4 clipPlane. This will be used to clip the 3dScene at
    Xmin / Xmax / Ymin / Ymax. This change has no effect at the moment
    because  `gl_ClipDistance` needs to be computed in each vertex or
    geometry shader file. This will be achieved in the following commits.
    ptitjano committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e0b0c65 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2024

  1. 3d: Add support for gl_ClipDistance in the default vertex shader file

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    
    The associated unit test needs to be updated because the objects at
    the border of the scene are now partially cut.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    7c161d8 View commit details
    Browse the repository at this point in the history
  2. qgsdemterraintileloader: Simplify createTextureComponent signature

    All the existing parameters are stored in
    `Qgs3DMapSettings`. Therefore, `Qgs3DMapSettings` can be directly
    used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    d29b940 View commit details
    Browse the repository at this point in the history
  3. qgsdiffusespecularmaterial: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    f39e189 View commit details
    Browse the repository at this point in the history
  4. qgstexturematerial: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    d54610c View commit details
    Browse the repository at this point in the history
  5. phongDataDefined: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    403762f View commit details
    Browse the repository at this point in the history
  6. goochDataDefined: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    9f933b4 View commit details
    Browse the repository at this point in the history
  7. qgssimplelinematerialsettings: Add support for gl_ClipDistance

    This one is a little bit to the other ones. Indeed, lines has a
    geometry shader with redefine gl_Position. Therefore, gl_ClipDistance
    needs to be computed in the geometry shader file.
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    f0b289f View commit details
    Browse the repository at this point in the history
  8. qgsinstancedpoint3d: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    3ca8205 View commit details
    Browse the repository at this point in the history
  9. qgspointcloud3dsymbol: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    e58c189 View commit details
    Browse the repository at this point in the history
  10. qgsmesh3dmaterial: Add support for gl_ClipDistance

    This is achieved with two changes:
    1. define the plane equation as uniform with the
    `Qgs3DUtils::addBoundingBoxParametersToEffect` call
    2. include `clipplane.inc` file in the vertex shader file and call
    setClipDistance()
    
    With these changes, the planes defined in the framegraph are used.
    ptitjano committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    0bb1e81 View commit details
    Browse the repository at this point in the history