mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
Merge branch 'FyroxEngine:master' into tiles
This commit is contained in:
@@ -457,11 +457,13 @@ impl Mesh {
|
||||
let data = data.data_ref();
|
||||
if surface.bones().is_empty() {
|
||||
for view in data.vertex_buffer.iter() {
|
||||
let Ok(vertex_pos) = view.read_3_f32(VertexAttributeUsage::Position) else {
|
||||
break;
|
||||
};
|
||||
|
||||
bounding_box.add_point(
|
||||
self.global_transform()
|
||||
.transform_point(&Point3::from(
|
||||
view.read_3_f32(VertexAttributeUsage::Position).unwrap(),
|
||||
))
|
||||
.transform_point(&Point3::from(vertex_pos))
|
||||
.coords,
|
||||
);
|
||||
}
|
||||
@@ -481,20 +483,20 @@ impl Mesh {
|
||||
|
||||
for view in data.vertex_buffer.iter() {
|
||||
let mut position = Vector3::default();
|
||||
for (&bone_index, &weight) in view
|
||||
.read_4_u8(VertexAttributeUsage::BoneIndices)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.zip(
|
||||
view.read_4_f32(VertexAttributeUsage::BoneWeight)
|
||||
.unwrap()
|
||||
.iter(),
|
||||
)
|
||||
{
|
||||
|
||||
let Ok(vertex_pos) = view.read_3_f32(VertexAttributeUsage::Position) else {
|
||||
break;
|
||||
};
|
||||
let Ok(bone_indices) = view.read_4_u8(VertexAttributeUsage::BoneIndices) else {
|
||||
break;
|
||||
};
|
||||
let Ok(bone_weights) = view.read_4_f32(VertexAttributeUsage::BoneWeight) else {
|
||||
break;
|
||||
};
|
||||
|
||||
for (&bone_index, &weight) in bone_indices.iter().zip(bone_weights.iter()) {
|
||||
position += bone_matrices[bone_index as usize]
|
||||
.transform_point(&Point3::from(
|
||||
view.read_3_f32(VertexAttributeUsage::Position).unwrap(),
|
||||
))
|
||||
.transform_point(&Point3::from(vertex_pos))
|
||||
.coords
|
||||
.scale(weight);
|
||||
}
|
||||
|
||||
+28
-6
@@ -25,8 +25,8 @@
|
||||
|
||||
use crate::{
|
||||
core::{
|
||||
algebra::Vector2, math::Rect, pool::Handle, reflect::prelude::*, type_traits::prelude::*,
|
||||
uuid_provider, variable::InheritableVariable, visitor::prelude::*,
|
||||
algebra::Vector2, log::Log, math::Rect, pool::Handle, reflect::prelude::*,
|
||||
type_traits::prelude::*, uuid_provider, variable::InheritableVariable, visitor::prelude::*,
|
||||
},
|
||||
define_constructor,
|
||||
draw::{CommandTexture, Draw, DrawingContext},
|
||||
@@ -115,6 +115,8 @@ pub struct GridDimension {
|
||||
/// For Auto rows and columns this is initially the number of nodes in that row or column,
|
||||
/// and then it is reduced as nodes are measured.
|
||||
/// This is zero for all non-Auto rows and columns.
|
||||
#[visit(skip)]
|
||||
#[reflect(hidden)]
|
||||
unmeasured_node_count: usize,
|
||||
}
|
||||
|
||||
@@ -456,8 +458,24 @@ impl Grid {
|
||||
let Some(node) = ui.try_get(*handle) else {
|
||||
continue;
|
||||
};
|
||||
let row = &mut rows[node.row()];
|
||||
let col = &mut cols[node.column()];
|
||||
let Some(row) = rows.get_mut(node.row()) else {
|
||||
Log::err(format!(
|
||||
"Node row out of bounds: {} row:{}, column:{}",
|
||||
node.type_name(),
|
||||
node.row(),
|
||||
node.column()
|
||||
));
|
||||
continue;
|
||||
};
|
||||
let Some(col) = cols.get_mut(node.column()) else {
|
||||
Log::err(format!(
|
||||
"Node column out of bounds: {} row:{}, column:{}",
|
||||
node.type_name(),
|
||||
node.row(),
|
||||
node.column()
|
||||
));
|
||||
continue;
|
||||
};
|
||||
if col.size_mode == SizeMode::Auto {
|
||||
col.unmeasured_node_count += 1
|
||||
}
|
||||
@@ -479,8 +497,12 @@ impl Grid {
|
||||
};
|
||||
let mut rows = self.rows.borrow_mut();
|
||||
let mut cols = self.columns.borrow_mut();
|
||||
let row = &mut rows[node.row()];
|
||||
let col = &mut cols[node.column()];
|
||||
let Some(row) = rows.get_mut(node.row()) else {
|
||||
return;
|
||||
};
|
||||
let Some(col) = cols.get_mut(node.column()) else {
|
||||
return;
|
||||
};
|
||||
let constraint = Vector2::new(
|
||||
choose_constraint(col, available_size.x),
|
||||
choose_constraint(row, available_size.y),
|
||||
|
||||
@@ -775,7 +775,7 @@ impl TreeBuilder {
|
||||
panel
|
||||
}),
|
||||
)
|
||||
.add_column(Column::auto())
|
||||
.add_column(Column::stretch())
|
||||
.add_row(Row::strict(24.0))
|
||||
.add_row(Row::stretch())
|
||||
.build(ctx);
|
||||
|
||||
Reference in New Issue
Block a user