110 using UiTaskList = std::vector<std::shared_ptr<BasicUiRenderTask>>;
148 virtual size_t glBytes()
const = 0;
166template <
typename ...Bases>
167requires ( ( std::derived_from<Bases, IRenderObject> && !std::same_as<Bases, IRenderObject> ) && ... )
179 (void)( ..., ( ret = Bases::render( params ) || ret ) );
183 size_t heapBytes()
const override {
return ( std::size_t{} + ... + Bases::heapBytes() ); }
184 size_t glBytes()
const override {
return ( std::size_t{} + ... + Bases::glBytes() ); }
191template<
typename ObjectType>
194 static_assert( std::is_base_of_v<VisualObject, std::remove_reference_t<ObjectType>>,
"MR::VisualObject is not base of ObjectType" );
200template<
typename RenderObjType>
203 return [] (
const VisualObject& visObj ) {
return std::make_unique<RenderObjType>( visObj ); };
212#define MR_REGISTER_RENDER_OBJECT_IMPL(objectType, ...)\
213 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:133
virtual bool render(const ModelRenderParams ¶ms)=0
Definition MRIRenderObject.h:160
virtual void forceBindAll()
binds all data for this render object, not to bind ever again (until object becomes dirty)
Definition MRIRenderObject.h:150
virtual size_t heapBytes() const =0
returns the amount of memory this object occupies on heap
Definition MRIRenderObject.h:162
virtual void renderUi(const UiRenderParams ¶ms)
Definition MRIRenderObject.h:156
virtual void renderPicker(const ModelBaseRenderParams ¶ms, unsigned geomId)=0
Definition MRIRenderObject.h:161
virtual ~IRenderObject()=default
virtual size_t glBytes() const =0
returns the amount of memory this object allocated in OpenGL
Definition MRIRenderObject.h:163
Definition MRIRenderObject.h:207
MRMESH_API RegisterRenderObjectConstructor(const std::type_index &type, IRenderObjectConstructorLambda lambda)
Definition MRIRenderObject.h:169
size_t glBytes() const override
Definition MRIRenderObject.h:184
void renderUi(const UiRenderParams ¶ms) override
Definition MRIRenderObject.h:186
size_t heapBytes() const override
Definition MRIRenderObject.h:183
bool render(const ModelRenderParams ¶ms) override
Definition MRIRenderObject.h:175
void renderPicker(const ModelBaseRenderParams ¶ms, unsigned geomId) override
Definition MRIRenderObject.h:182
RenderObjectCombinator(const VisualObject &object)
Definition MRIRenderObject.h:171
void forceBindAll() override
Definition MRIRenderObject.h:185
Definition MRViewportId.h:16
Visual Object.
Definition MRVisualObject.h:131
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
Definition MRCameraOrientationPlugin.h:7
IRenderObjectConstructorLambda makeRenderObjectConstructor()
Definition MRIRenderObject.h:201
RenderModelPassMask
Various passes of the 3D rendering.
Definition MRRenderModelParameters.h:10
std::function< std::unique_ptr< IRenderObject >(const VisualObject &)> IRenderObjectConstructorLambda
Definition MRIRenderObject.h:198
DepthFunction
Definition MRIRenderObject.h:17
MRMESH_API std::unique_ptr< IRenderObject > createRenderObject(const VisualObject &visObj, const std::type_index &type)
Common rendering parameters for meshes and UI.
Definition MRIRenderObject.h:32
const Matrix4f & viewMatrix
Definition MRIRenderObject.h:33
Vector4i viewport
Definition MRIRenderObject.h:36
const Matrix4f & projMatrix
Definition MRIRenderObject.h:34
ViewportId viewportId
Definition MRIRenderObject.h:35
Definition MRIRenderObject.h:80
bool tryConsumeMouseHover() const
Definition MRIRenderObject.h:86
IRenderObject::renderUi() can emit zero or more or more of those tasks. They are sorted by depth ever...
Definition MRIRenderObject.h:60
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:99
float renderTaskDepth
The tasks are sorted by this depth, descending (larger depth = further away).
Definition MRIRenderObject.h:70
BasicUiRenderTask(BasicUiRenderTask &&)=default
virtual ~BasicUiRenderTask()=default
InteractionMask
Definition MRIRenderObject.h:73
BasicUiRenderTask & operator=(BasicUiRenderTask &&)=default
Definition MRIRenderObject.h:42
const Matrix4f & modelMatrix
Definition MRIRenderObject.h:43
DepthFunction depthFunction
Definition MRIRenderObject.h:45
const Plane3f & clipPlane
Definition MRIRenderObject.h:44
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:50
Vector3f lightPos
Definition MRIRenderObject.h:52
RenderModelPassMask passMask
Definition MRIRenderObject.h:55
const Matrix4f * normMatrixPtr
Definition MRIRenderObject.h:51
bool allowAlphaSort
Definition MRIRenderObject.h:53
Definition MRIRenderObject.h:117
virtual ~UiRenderManager()=default
virtual BasicUiRenderTask::BackwardPassParams beginBackwardPass(ViewportId viewport, UiRenderParams::UiTaskList &tasks)
Definition MRIRenderObject.h:127
virtual void finishBackwardPass(const BasicUiRenderTask::BackwardPassParams ¶ms)
Definition MRIRenderObject.h:129
virtual void preRenderViewport(ViewportId viewport)
Definition MRIRenderObject.h:121
virtual void postRenderViewport(ViewportId viewport)
Definition MRIRenderObject.h:123
Definition MRIRenderObject.h:106
UiTaskList * tasks
Definition MRIRenderObject.h:113
std::vector< std::shared_ptr< BasicUiRenderTask > > UiTaskList
Definition MRIRenderObject.h:110
float scale
Multiply all your hardcoded sizes by this amount.
Definition MRIRenderObject.h:108