Comments (6)
...finally, let say that we could close it since I will "break" im3d internals for these wrappers and use local new/delete scheme
from im3d.
It wouldn't break the internals, but it would be a breaking change for users who have set up the im3d_config.h
file. The purpose of that is to have a single, central place for users to configure the library and then receive updates by overwriting the other library files. No, it's not elegant but it is very simple!
It's common for users to extend Im3d by adding stuff to im3d_config.h
- so in your case adding IM3D_NEW()
,IM3D_DELETE()
, etc. macros there would be in line with the typical way of extending the library.
from im3d.
Please consider this: https://github.com/ocornut/imgui/blob/6b2e03c5b1bc4f99dbd86d10e5fd12af9e3fe1c2/imgui.h#L1772-L1779
from im3d.
I don't think I understand the use case - these macros are only used internally so there's no need for the defaults to be externally visible.
from im3d.
I am wrapping im3d into im3d_impl_win32
and im3d_impl_dx12
similarly to:
https://github.com/ocornut/imgui/tree/master/backends
This req allows to be consistent with im3d
in such a wrapper (even defaults with malloc/free does not trigger ctor/dtor), e.g.:
bool Im3d_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* heap)
{
Im3d::AppData& ad = Im3d::GetAppData();
IM3D_ASSERT(ad.m_rendererData == nullptr && "The im3d already initialized at platform backend!");
// IM3D_ASSERT(device);
// IM3D_ASSERT(num_frames_in_flight > 0);
// IM3D_ASSERT(heap);
Im3d_ImplDX12_Data* data = (Im3d_ImplDX12_Data*)IM3D_MALLOC(sizeof(Im3d_ImplDX12_Data));
ad.m_rendererData = (void*)data;
data->device_ = device;
data->heap_ = heap;
data->num_frames_in_flight_ = num_frames_in_flight;
data->frame_index_ = UINT_MAX;
data->rtv_format_ = rtv_format;
data->frame_resources_ = (Im3d_ImplDX12_RenderBuffers*)IM3D_MALLOC(num_frames_in_flight * sizeof(Im3d_ImplDX12_RenderBuffers));
for (int index = 0; index < num_frames_in_flight; ++index)
{
Im3d_ImplDX12_RenderBuffers* render_buffer = &data->frame_resources_[index];
render_buffer->index_buffer_ = nullptr;
render_buffer->vertex_buffer_ = nullptr;
render_buffer->index_buffer_size_ = 0;
render_buffer->vertex_buffer_size_ = 0;
}
(...)
return true;
}
btw: IM3D_ASSERT
is visible from im3d.h
😇
from im3d.
Yes, I understand.
Let's proceed then with the current approach for extending the library 🚀
from im3d.
Related Issues (20)
- Intersect(Ray, Capsule) HOT 1
- plane drawing issue in local mode HOT 1
- memory leak HOT 3
- Add IM3D_API macro for dll export HOT 2
- Detect NaNs
- wrong behavior when scale the model HOT 3
- Prevent gizmo flip while gizmo is in use
- Question: How to draw multiple shapes in different locations? HOT 2
- Depth testing for Triangle primitives HOT 4
- Custom include for im3d_config.h HOT 1
- Ids don't get reset if some control is still active and no subsequent Im3d::Gizmo call HOT 1
- Plug into existing application HOT 1
- im3d default Camera model does not suppot aspect ratio on height HOT 4
- is it possible to make this tools usable for qt? HOT 1
- Deal with transformed world coordinates. HOT 1
- C Bindings HOT 1
- Question: Weird plane orientation HOT 4
- OSX support HOT 4
- Consider to split `AppData::m_appData` into platform and renderer depended
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from im3d.