3#include "MRPch/MRBindingMacros.h"
111 using UiTaskList = std::vector<std::shared_ptr<BasicUiRenderTask>>;
149 virtual size_t glBytes()
const = 0;
167template <
typename ...Bases>
168requires ( ( std::derived_from<Bases, IRenderObject> && !std::same_as<Bases, IRenderObject> ) && ... )
180 (void)( ..., ( ret = Bases::render( params ) || ret ) );
184 size_t heapBytes()
const override {
return ( std::size_t{} + ... + Bases::heapBytes() ); }
185 size_t glBytes()
const override {
return ( std::size_t{} + ... + Bases::glBytes() ); }
192template<
typename ObjectType>
195 static_assert( std::is_base_of_v<VisualObject, std::remove_reference_t<ObjectType>>,
"MR::VisualObject is not base of ObjectType" );
201template<
typename RenderObjType>
204 return [] (
const VisualObject& visObj ) {
return std::make_unique<RenderObjType>( visObj ); };
213#define MR_REGISTER_RENDER_OBJECT_IMPL(objectType, ...)\
214 static MR::RegisterRenderObjectConstructor __objectRegistrator##objectType{typeid(objectType),makeRenderObjectConstructor<__VA_ARGS__>()};
#define MR_MAKE_FLAG_OPERATORS_IN_CLASS(T)
Definition MRFlagOperators.h:9
#define MR_MAKE_FLAG_OPERATORS(T)
Definition MRFlagOperators.h:6
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRIRenderObject.h:134
virtual bool render(const ModelRenderParams ¶ms)=0
Definition MRIRenderObject.h:161
virtual void forceBindAll()
binds all data for this render object, not to bind ever again (until object becomes dirty)
Definition MRIRenderObject.h:151
virtual size_t heapBytes() const =0
returns the amount of memory this object occupies on heap
Definition MRIRenderObject.h:163
virtual void renderUi(const UiRenderParams ¶ms)
Definition MRIRenderObject.h:157
virtual void renderPicker(const ModelBaseRenderParams ¶ms, unsigned geomId)=0
Definition MRIRenderObject.h:162
virtual ~IRenderObject()=default
virtual size_t glBytes() const =0
returns the amount of memory this object allocated in OpenGL
Definition MRIRenderObject.h:164
Definition MRIRenderObject.h:208
MRMESH_API RegisterRenderObjectConstructor(const std::type_index &type, IRenderObjectConstructorLambda lambda)
Definition MRIRenderObject.h:170
size_t glBytes() const override
Definition MRIRenderObject.h:185
void renderUi(const UiRenderParams ¶ms) override
Definition MRIRenderObject.h:187
size_t heapBytes() const override
Definition MRIRenderObject.h:184
bool render(const ModelRenderParams ¶ms) override
Definition MRIRenderObject.h:176
void renderPicker(const ModelBaseRenderParams ¶ms, unsigned geomId) override
Definition MRIRenderObject.h:183
RenderObjectCombinator(const VisualObject &object)
Definition MRIRenderObject.h:172
void forceBindAll() override
Definition MRIRenderObject.h:186
Definition MRViewportId.h:16
Visual Object.
Definition MRVisualObject.h:131
Definition MRCameraOrientationPlugin.h:8
RenderModelPassMask
Various passes of the 3D rendering.
Definition MRRenderModelParameters.h:10
std::function< std::unique_ptr< IRenderObject >(const VisualObject &)> IRenderObjectConstructorLambda
Definition MRIRenderObject.h:199
MR_BIND_IGNORE IRenderObjectConstructorLambda makeRenderObjectConstructor()
Definition MRIRenderObject.h:202
MR_BIND_IGNORE MRMESH_API std::unique_ptr< IRenderObject > createRenderObject(const VisualObject &visObj, const std::type_index &type)
DepthFunction
Definition MRIRenderObject.h:18
Common rendering parameters for meshes and UI.
Definition MRIRenderObject.h:33
const Matrix4f & viewMatrix
Definition MRIRenderObject.h:34
Vector4i viewport
Definition MRIRenderObject.h:37
const Matrix4f & projMatrix
Definition MRIRenderObject.h:35
ViewportId viewportId
Definition MRIRenderObject.h:36
Definition MRIRenderObject.h:81
bool tryConsumeMouseHover() const
Definition MRIRenderObject.h:87
IRenderObject::renderUi() can emit zero or more or more of those tasks. They are sorted by depth ever...
Definition MRIRenderObject.h:61
BasicUiRenderTask()=default
virtual void renderPass()=0
This is the main rendering pass.
BasicUiRenderTask & operator=(const BasicUiRenderTask &)=default
BasicUiRenderTask(const BasicUiRenderTask &)=default
virtual void earlyBackwardPass(const BackwardPassParams ¶ms)
Definition MRIRenderObject.h:100
float renderTaskDepth
The tasks are sorted by this depth, descending (larger depth = further away).
Definition MRIRenderObject.h:71
BasicUiRenderTask(BasicUiRenderTask &&)=default
virtual ~BasicUiRenderTask()=default
InteractionMask
Definition MRIRenderObject.h:74
BasicUiRenderTask & operator=(BasicUiRenderTask &&)=default
Definition MRIRenderObject.h:43
const Matrix4f & modelMatrix
Definition MRIRenderObject.h:44
DepthFunction depthFunction
Definition MRIRenderObject.h:46
const Plane3f & clipPlane
Definition MRIRenderObject.h:45
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:51
Vector3f lightPos
Definition MRIRenderObject.h:53
RenderModelPassMask passMask
Definition MRIRenderObject.h:56
const Matrix4f * normMatrixPtr
Definition MRIRenderObject.h:52
bool allowAlphaSort
Definition MRIRenderObject.h:54
Definition MRIRenderObject.h:118
virtual ~UiRenderManager()=default
virtual BasicUiRenderTask::BackwardPassParams beginBackwardPass(ViewportId viewport, UiRenderParams::UiTaskList &tasks)
Definition MRIRenderObject.h:128
virtual void finishBackwardPass(const BasicUiRenderTask::BackwardPassParams ¶ms)
Definition MRIRenderObject.h:130
virtual void preRenderViewport(ViewportId viewport)
Definition MRIRenderObject.h:122
virtual void postRenderViewport(ViewportId viewport)
Definition MRIRenderObject.h:124
Definition MRIRenderObject.h:107
UiTaskList * tasks
Definition MRIRenderObject.h:114
std::vector< std::shared_ptr< BasicUiRenderTask > > UiTaskList
Definition MRIRenderObject.h:111
float scale
Multiply all your hardcoded sizes by this amount.
Definition MRIRenderObject.h:109