tirbofish/dropbear · diff
fix: some standard bug fixes to the editor.
Signature present but could not be verified.
Unverified
@@ -637,8 +637,8 @@ impl Component for MeshRenderer { } fn update_component(&mut self, world: &World, entity: Entity, _dt: f32, _graphics: Arc<SharedGraphicsContext>) { - if let Ok((mesh, transform)) = world.query_one::<(&mut MeshRenderer, &EntityTransform)>(entity).get() { - mesh.update(&transform.propagate(&world, entity)) + if let Ok(transform) = world.query_one::<&EntityTransform>(entity).get() { + self.update(&transform.propagate(&world, entity)) } } @@ -171,9 +171,16 @@ impl Keyboard for Editor { return; }; - let components = self + let mut components = self .component_registry .extract_all_components(self.world.as_ref(), *entity); + components.retain(|component| { + self.component_registry + .id_for_component(component.as_ref()) + .and_then(|id| self.component_registry.get_descriptor_by_numeric_id(id)) + .map(|desc| desc.fqtn != "dropbear_engine::entity::EntityTransform") + .unwrap_or(true) + }); let s_entity = SceneEntity { label: Label::new(label.as_str()), components, @@ -920,9 +920,16 @@ impl Editor { return; }; - let components = self + let mut components = self .component_registry .extract_all_components(self.world.as_ref(), *entity); + components.retain(|component| { + self.component_registry + .id_for_component(component.as_ref()) + .and_then(|id| self.component_registry.get_descriptor_by_numeric_id(id)) + .map(|desc| desc.fqtn != "dropbear_engine::entity::EntityTransform") + .unwrap_or(true) + }); let s_entity = SceneEntity { label: Label::new(label.as_str()), components, @@ -14,7 +14,13 @@ impl<'a> EditorTabViewer<'a> { let available_rect = ui.available_rect_before_wrap(); let available_size = available_rect.size(); - *self.signal = Signal::UpdateViewportSize((available_size.x, available_size.y)); + let desired_width = available_size.x.max(1.0).round() as u32; + let desired_height = available_size.y.max(1.0).round() as u32; + if self.tex_size.width != desired_width || self.tex_size.height != desired_height { + if matches!(*self.signal, Signal::None) { + *self.signal = Signal::UpdateViewportSize((available_size.x, available_size.y)); + } + } let tex_aspect = self.tex_size.width as f32 / self.tex_size.height as f32; let available_aspect = available_size.x / available_size.y; @@ -179,7 +179,31 @@ typedef struct NChannelValuesFfi { typedef NChannelValuesFfi NChannelValues; -typedef void* GraphicsContextPtr; +typedef struct NRange { + float start; + float end; +} NRange; + +typedef void* SceneLoaderPtr; + +typedef struct NAttenuation { + float constant; + float linear; + float quadratic; +} NAttenuation; + +typedef struct NColour { + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t a; +} NColour; + +typedef struct AxisLock { + bool x; + bool y; + bool z; +} AxisLock; typedef struct IndexNative { uint32_t index; @@ -192,36 +216,83 @@ typedef struct NCollider { uint32_t id; } NCollider; -typedef struct NColliderArray { - NCollider* values; - size_t length; - size_t capacity; -} NColliderArray; - typedef struct u64Array { uint64_t* values; size_t length; size_t capacity; } u64Array; +typedef void* InputStatePtr; + +typedef void* AssetRegistryPtr; + +typedef struct RayHit { + NCollider collider; + double distance; +} RayHit; + +typedef struct NShapeCastHit { + NCollider collider; + double distance; + NVector3 witness1; + NVector3 witness2; + NVector3 normal1; + NVector3 normal2; + NShapeCastStatus status; +} NShapeCastHit; + +typedef struct RigidBodyContext { + IndexNative index; + uint64_t entity_id; +} RigidBodyContext; + typedef struct ConnectedGamepadIds { u64Array ids; } ConnectedGamepadIds; -typedef struct NColour { - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; -} NColour; +typedef void* PhysicsStatePtr; -typedef void* AssetRegistryPtr; +typedef struct i32Array { + int32_t* values; + size_t length; + size_t capacity; +} i32Array; -typedef struct AxisLock { - bool x; - bool y; - bool z; -} AxisLock; +typedef struct f64ArrayArray { + double* values; + size_t length; + size_t capacity; +} f64ArrayArray; + +typedef struct NSkin { + const char* name; + i32Array joints; + f64ArrayArray inverse_bind_matrices; + const int32_t* skeleton_root; +} NSkin; + +typedef struct NSkinArray { + NSkin* values; + size_t length; + size_t capacity; +} NSkinArray; + +typedef struct NColliderArray { + NCollider* values; + size_t length; + size_t capacity; +} NColliderArray; + +typedef struct IndexNativeArray { + IndexNative* values; + size_t length; + size_t capacity; +} IndexNativeArray; + +typedef struct CharacterCollisionArray { + uint64_t entity_id; + IndexNativeArray collisions; +} CharacterCollisionArray; typedef struct NVector4 { double x; @@ -235,6 +306,36 @@ typedef struct NVector2 { double y; } NVector2; +typedef struct NModelVertex { + NVector3 position; + NVector3 normal; + NVector4 tangent; + NVector2 tex_coords0; + NVector2 tex_coords1; + NVector4 colour0; + i32Array joints0; + NVector4 weights0; +} NModelVertex; + +typedef struct NModelVertexArray { + NModelVertex* values; + size_t length; + size_t capacity; +} NModelVertexArray; + +typedef struct NMesh { + const char* name; + int32_t num_elements; + int32_t material_index; + NModelVertexArray vertices; +} NMesh; + +typedef struct NMeshArray { + NMesh* values; + size_t length; + size_t capacity; +} NMeshArray; + typedef struct NMaterial { const char* name; uint64_t diffuse_texture; @@ -259,6 +360,14 @@ typedef struct NMaterialArray { size_t capacity; } NMaterialArray; +typedef struct NTransform { + NVector3 position; + NQuaternion rotation; + NVector3 scale; +} NTransform; + +typedef void* GraphicsContextPtr; + typedef struct f64Array { double* values; size_t length; @@ -290,121 +399,12 @@ typedef struct NAnimationArray { size_t capacity; } NAnimationArray; -typedef void* InputStatePtr; - -typedef void* SceneLoaderPtr; - -typedef void* PhysicsStatePtr; - -typedef struct i32Array { - int32_t* values; - size_t length; - size_t capacity; -} i32Array; - -typedef struct NModelVertex { - NVector3 position; - NVector3 normal; - NVector4 tangent; - NVector2 tex_coords0; - NVector2 tex_coords1; - NVector4 colour0; - i32Array joints0; - NVector4 weights0; -} NModelVertex; - -typedef struct NModelVertexArray { - NModelVertex* values; - size_t length; - size_t capacity; -} NModelVertexArray; - -typedef struct NMesh { - const char* name; - int32_t num_elements; - int32_t material_index; - NModelVertexArray vertices; -} NMesh; - -typedef struct NMeshArray { - NMesh* values; - size_t length; - size_t capacity; -} NMeshArray; - -typedef struct f64ArrayArray { - double* values; - size_t length; - size_t capacity; -} f64ArrayArray; - -typedef struct NSkin { - const char* name; - i32Array joints; - f64ArrayArray inverse_bind_matrices; - const int32_t* skeleton_root; -} NSkin; - -typedef struct NSkinArray { - NSkin* values; - size_t length; - size_t capacity; -} NSkinArray; - -typedef struct NTransform { - NVector3 position; - NQuaternion rotation; - NVector3 scale; -} NTransform; - -typedef struct IndexNativeArray { - IndexNative* values; - size_t length; - size_t capacity; -} IndexNativeArray; - -typedef struct CharacterCollisionArray { - uint64_t entity_id; - IndexNativeArray collisions; -} CharacterCollisionArray; - -typedef struct NAttenuation { - float constant; - float linear; - float quadratic; -} NAttenuation; - -typedef struct RayHit { - NCollider collider; - double distance; -} RayHit; - typedef struct Progress { size_t current; size_t total; const char* message; } Progress; -typedef struct RigidBodyContext { - IndexNative index; - uint64_t entity_id; -} RigidBodyContext; - -typedef struct NRange { - float start; - float end; -} NRange; - -typedef struct NShapeCastHit { - NCollider collider; - double distance; - NVector3 witness1; - NVector3 witness2; - NVector3 normal1; - NVector3 normal2; - NShapeCastStatus status; -} NShapeCastHit; - typedef struct NNodeTransform { NVector3 translation; NQuaternion rotation;