Skip to content

Commit

Permalink
doc: dev guides for adding new mesh attributes name / type.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Feb 7, 2020
1 parent 6338ac4 commit 7bf1a0b
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion doc/developers.dox
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ in inverse --- but usually @ref developers-deprecation "deprecate first".
- run [doxygen.py](http://mcss.mosra.cz/doxygen/) on `Doxyfile-mcss`
and verify there are no new warnings
- eyeball the relevant docs and fix suspicious things
10. Push to a temporary branch (e.g., `next`)
10. Push to a temporary branch (e.g., `next`)
11. Iterate until the CIs are green
12. Merge to `master`
13. If possible, trigger builds of dependent projects (where they are still
Expand Down Expand Up @@ -488,6 +488,57 @@ in inverse --- but usually @ref developers-deprecation "deprecate first".
8. If possible, trigger builds of dependent projects and verify they are still
green (or wait for the scheduled builds)

@section developers-adding-attribute Checklist for adding a new mesh attribute

1. Extend @ref Trade::MeshAttributeName with the new entry
2. Add a corresponding reserved type to @ref Shaders::Generic, if not there
already
- Also update `src/Magnum/Shaders/generic.glsl` with the reserved ID
3. Update the type assertion in the @ref Trade::MeshAttributeData constructor
to account for the new type
4. Add a pair of convenience getters to @ref Trade::MeshData similar to e.g.
@ref Trade::MeshData::normalsInto() / @ref Trade::MeshData::normalsAsArray()
with a type that's the same as the one used in the @ref Shaders::Generic
definition, test that it does the right thing for every supported type
5. Update @ref Trade::operator<<(Debug&, MeshAttributeName) for the new entry
6. Update @ref MeshTools::compile() to recognize the new attribute. If there
is already a builtin shader capable of using this attribute, add new test
to `MeshToolsCompileGLTest`.
7. Push to a temporary branch (e.g., `next`)
8. Iterate until the CIs are green
9. Merge to `master`

@section developers-adding-attribute-type Checklist for adding a new mesh attribute type

1. Extend @ref MeshAttributeType with the new entry, if it's not there already
2. Update docs of @ref Trade::MeshAttributeName to mention where the type can
be newly used
3. Appropriately relax the assertion in the @ref Trade::MeshAttributeData
constructor
3. Extend `Trade::Implementation::meshAttributeTypeFor()`, add a mapping
between this entry and a C++ type, optionally also
`isMeshAttributeCompatible()` if there's more than one entry corresponding
to a particular C++ type. If the mapping is unconventional, be sure to
mention it in the @ref Trade::MeshAttributeData::MeshAttributeData(MeshAttributeName, const Containers::StridedArrayView1D<T>&)
constructor docs.
4. Update corresponding `Trade::MeshData::*Into()` convenience getters to
ensure they can handle this type
5. Update `src/Magnum/Implementation/meshAttributeTypeMapping.hpp` with the
new entry
6. Update @ref meshAttributeTypeSize(), @ref meshAttributeTypeComponentType(),
@ref meshAttributeTypeComponentCount() and @ref isMeshAttributeTypeNormalized()
to handle this type
7. Update the @ref GL::DynamicAttribute::DynamicAttribute(Kind, UnsignedInt, MeshAttributeType)
constructor to provide mapping of the new type to GL; add a test for the
new type
8. Update @ref MeshTools::compile() to recognize the new type (if anything
extra needs to be done, usually doesn't as everything is handled by
@ref GL::DynamicAttribute already); add corresponding new test(s) to
`MeshToolsCompileGLTest`.
9. Push to a temporary branch (e.g., `next`)
10. Iterate until the CIs are green
11. Merge to `master`

@section developers-gl-extensions Checklist for adding / removing GL versions and extensions

1. Install [flextGL](https://github.com/mosra/flextgl)
Expand Down

0 comments on commit 7bf1a0b

Please sign in to comment.