Age | Commit message (Collapse) | Author |
|
To solve this, the unproject code was redone in order to simplify and optimize.
|
|
When projecting into screen space Z value isn't always needed.
Add 2D projection functions, renaming them to avoid accidents
happening again.
- Add GPU_matrix_project_2fv
- Add ED_view3d_project_v2
- Rename ED_view3d_project to ED_view3d_project_v3
- Use the 2D versions of these functions when the Z value isn't used.
|
|
|
|
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.
This patch has been generated by P1561 followed by `make format`.
Differential Revision: https://developer.blender.org/D8466
|
|
|
|
And move it to GPU module.
|
|
Normal UI widget and 3D navigation gizmo where clipping at high DPI.
|
|
Useful when UI code needs to extend the clipping range.
|
|
Some statements were split across multiple lines because of their
trailing comments.
In most cases it's clearer to put the comments above.
|
|
Pre-calculates values needed for unprojecting to avoid
a matrix invert and extracting projection matrix dimensions for
every call to GPU_matrix_unproject.
Use for gizmo selection drawing.
|
|
This is normally already calculated so add a version that takes the
inverted matrix.
|
|
|
|
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
|
|
While \file doesn't need an argument, it can't have another doxy
command after it.
|
|
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
|
|
BF-admins agree to remove header information that isn't useful,
to reduce noise.
- BEGIN/END license blocks
Developers should add non license comments as separate comment blocks.
No need for separator text.
- Contributors
This is often invalid, outdated or misleading
especially when splitting files.
It's more useful to git-blame to find out who has developed the code.
See P901 for script to perform these edits.
|
|
|
|
Thanks to @sergey for review
|
|
Avoids requiring glew headers in Python API.
|
|
Raise exception when stack limits are reached.
|
|
Complicated using GPU_matrix from PyAPI.
|
|
Looking up names project wide or setting breakpoints wasn't so.
Names like common.h or element.h are also too generic.
|
|
Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678
|
|
Since the change to core profile this is no longer supported.
|
|
There is no more point of keep those around. ES20 may need special case
when/if we dabble with it again. Meanwhile no point on polluting the
code with this.
(ghost still has reference for the PROFILE, but that's reasonable)
|
|
With the explicit calls we don't need to worry about current state
outside of the GPU module now. In fact. we don't need to worry about
current matrix mode in core profile at all.
Legacy OpenGL now has some code which ensures current matrix mode
when using explicit calls to push/pop matrix.
|
|
There are two major things in this commit.
First one is to have proper stack for projection matrices. This is
something what OpenGL specification grants to have at least 2 elements
for and what is required to have for proper editor drawing without
refactoring the way how we restore projection matrix.
Supporting this stack have following advantages:
- Our GPU stack is closer to OpenGL specs, making it easier to follow
by other developers who are always familiar with OpenGL.
- Makes it easier to port all editors to a new API.
- Should help us getting rid of extra matrix push/pop added in
various commits to 2.8 branch.
The new API follows the following convention:
- gpuPushMatrix/gpuPopMatrix ALWAYS deals with model view matrix
and nothing more.
While this name does not fully indicate that it's only model view
matrix operator, it matches behavior of other matrix operations
such as transform which also doesn't indicate what matrix type
they are operating on.
- Projection matrix has dedicated calls for push/pop which are
gpuPushProjectionMatrix/gpuPopProjectionMatrix.
|
|
|
|
|
|
Without this gpuGet functions would cast everything
(no type or size checks and override const variables).
|
|
|
|
See GPU_matrix.h & gpu_matrix.c for the important changes. Other files are mostly just updated to use the latest API.
- remove unused functions, defines, enums, comments
- remove "3D" from function names
- init to Identity transform (otherwise empty stack)
- gpuMatrixReset lets outside code return to initial state
Part of T49450
Follow up to D2626 and 49fc9cff3b90
|
|
* Brings us closer to core profile, all matrices are working, and apart
from a problem with text drawing, Blender is working fine.
* Reduce the coding overhead of having to setup/teardown when
alternating between 2D and 3D drawing sessions.
* Gives us fewer modes and states we need to keep track of.
Unfortunatelly this also "rejects a fundamental change" the original
design was trying to make - that 2D is different from 3D and
deserves its own best implementation.
That said, it is still aligned with the function API design as
originally implemented (i.e., it still uses gpuTranslate2D, ...).
Finally, if you build with core profile and this patch you get:
https://developer.blender.org/F545352
[The text glitch is an unrelated issue].
Reviewers: merwin, sergey, brecht
Differential Revision: https://developer.blender.org/D2626
|
|
|
|
... even though 3x3 feels better.
This is a compromise to get core profile up & running sooner. Eventually I'd like to finish the original 3x3 plans, but this commit will let us get on with other tasks.
External API stays (almost) the same. Our GLSL shaders can use this without any changes.
Part of T49450 and T51164
|
|
This eliminates tons of glGetUniformLocation calls from the drawing loop. Vast majority of code can keep making the same function calls. They're just faster now!
- Batch_Uniform*
- immUniform*
- gpuBindMatrices
- and others
|
|
It helped during the transition, but we don't need this anymore. Evolution of T49450
|
|
Make an existing 4x4 matrix the current projection.
Found a need for this while converting code to new API.
Part of T49450
|
|
For functions that expect a 4x4 matrix, you can pass in that, or array[16], or float*, or... Casting at each call site can get annoying, and obscures the logic.
The C11 section still needs work, but the non-C11 macros help on the system I tested on (Mac/clang).
Part of T49450
|
|
No longer needed since 231b5d96bbfd77253941dd37cc4929e4e119d706 tracks dirty state of legacy matrix stacks.
Part of T49450
|
|
Part of T49042.
|
|
|
|
Marks matrix state as dirty so shader will use the latest values from glScale, glTranslate, etc.
We'll remove this after transitioning 100% to the new matrix API, which handles this sort of thing automatically.
Part of T49450
|
|
Part of T49450
|
|
Have matrices changed since the most recent bind?
Part of T49450
|
|
Was multiplying matrices backward, so concatenation was broken. Fixed!
Also a way to mix legacy matrix stacks with the new library. Just during the transition! Anything within SUPPORT_LEGACY_MATRIX will go away after we switch to core profile.
Part of T49450
|
|
Built-in shaders now use uniforms instead of legacy built-in matrices. So far I only hooked this up for new immediate mode.
We use the same matrix naming convention as OpenGL, but without the gl_ prefix, e.g. gl_ModelView becomes ModelView.
Right now it can skip the new matrix stack and use the legacy built-in matrices app-side. This will help us transition gradually from glMatrix functions to gpuMatrix functions.
Still some work to do in gpuBindMatrices. See TODO comments in gpu_matrix.c for specifics.
|
|
Complete (for our needs) 2D & 3D transformation API. Should be easy to port legacy OpenGL matrix stack-based code to this. Still needs testing.
Ported ortho, frustum, lookAt functions from Viewport FX (rB194998766c65). Kept plenty of Viewport FX code from previous commit.
Stack API and 2D routines ported from Gawain. This version uses BLI_math library so everything is licensed under GPL instead of the usual MPL.
Part of T49450
|
|
Proper fp64 is a GL 4.x feature. Pretending to support it in our API is just clutter.
|
|
Bringing over whole files from rB194998766c65
|