forked from StrafesNET/strafe-client
compiler error fallout
This commit is contained in:
parent
720b65d71e
commit
4a84d3a419
@ -1,6 +1,6 @@
|
|||||||
use std::borrow::{Borrow,Cow};
|
use std::borrow::{Borrow,Cow};
|
||||||
use std::collections::{HashSet,HashMap};
|
use std::collections::{HashSet,HashMap};
|
||||||
use strafesnet_common::model::{self,PolygonIter};
|
use strafesnet_common::model::{self,MeshId,PolygonIter};
|
||||||
use strafesnet_common::zeroes;
|
use strafesnet_common::zeroes;
|
||||||
use strafesnet_common::integer::{self,Planar64,Planar64Vec3};
|
use strafesnet_common::integer::{self,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
@ -110,8 +110,18 @@ struct PhysicsMeshTopology{
|
|||||||
edge_topology:Vec<EdgeRefs>,
|
edge_topology:Vec<EdgeRefs>,
|
||||||
vert_topology:Vec<VertRefs>,
|
vert_topology:Vec<VertRefs>,
|
||||||
}
|
}
|
||||||
#[derive(id::Id)]
|
#[derive(Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct PhysicsMeshId(u32);
|
pub struct PhysicsMeshId(u32);
|
||||||
|
impl Into<MeshId> for PhysicsMeshId{
|
||||||
|
fn into(self)->MeshId{
|
||||||
|
MeshId::new(self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<MeshId> for PhysicsMeshId{
|
||||||
|
fn from(value:MeshId)->Self{
|
||||||
|
Self::new(value.get())
|
||||||
|
}
|
||||||
|
}
|
||||||
#[derive(Debug,Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
#[derive(Debug,Clone,Copy,Hash,id::Id,Eq,PartialEq)]
|
||||||
pub struct PhysicsSubmeshId(u32);
|
pub struct PhysicsSubmeshId(u32);
|
||||||
pub struct PhysicsMesh{
|
pub struct PhysicsMesh{
|
||||||
@ -417,9 +427,9 @@ impl MeshQuery<SubmeshFaceId,SubmeshDirectedEdgeId,SubmeshVertId> for PhysicsMes
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct PhysicsMeshTransform{
|
pub struct PhysicsMeshTransform{
|
||||||
vertex:integer::Planar64Affine3,
|
pub vertex:integer::Planar64Affine3,
|
||||||
normal:integer::Planar64Mat3,
|
pub normal:integer::Planar64Mat3,
|
||||||
det:Planar64,
|
pub det:Planar64,
|
||||||
}
|
}
|
||||||
impl PhysicsMeshTransform{
|
impl PhysicsMeshTransform{
|
||||||
pub const fn new(transform:integer::Planar64Affine3)->Self{
|
pub const fn new(transform:integer::Planar64Affine3)->Self{
|
||||||
|
@ -6,7 +6,7 @@ use strafesnet_common::bvh;
|
|||||||
use strafesnet_common::map;
|
use strafesnet_common::map;
|
||||||
use strafesnet_common::aabb;
|
use strafesnet_common::aabb;
|
||||||
use strafesnet_common::gameplay_modes;
|
use strafesnet_common::gameplay_modes;
|
||||||
use strafesnet_common::gameplay_attributes;
|
use strafesnet_common::gameplay_attributes::{self,CollisionAttributesId};
|
||||||
use strafesnet_common::model::ModelId;
|
use strafesnet_common::model::ModelId;
|
||||||
use strafesnet_common::gameplay_style::{self,StyleModifiers};
|
use strafesnet_common::gameplay_style::{self,StyleModifiers};
|
||||||
use strafesnet_common::instruction::{self,InstructionEmitter,InstructionConsumer,TimedInstruction};
|
use strafesnet_common::instruction::{self,InstructionEmitter,InstructionConsumer,TimedInstruction};
|
||||||
@ -170,17 +170,17 @@ impl PhysicsModels{
|
|||||||
//TODO: "statically" verify the maps don't refer to any nonexistant data, if they do delete the references.
|
//TODO: "statically" verify the maps don't refer to any nonexistant data, if they do delete the references.
|
||||||
//then I can make these getter functions unchecked.
|
//then I can make these getter functions unchecked.
|
||||||
fn mesh(&self,convex_mesh_id:ConvexMeshId)->TransformedMesh{
|
fn mesh(&self,convex_mesh_id:ConvexMeshId)->TransformedMesh{
|
||||||
let model_idx=convex_mesh_id.model_id.get() as usize;
|
let model=self.models[&convex_mesh_id.model_id];
|
||||||
TransformedMesh::new(
|
TransformedMesh::new(
|
||||||
self.meshes[model_idx].submesh_view(convex_mesh_id.submesh_id),
|
self.meshes[&model.mesh_id].submesh_view(convex_mesh_id.submesh_id),
|
||||||
&self.models[model_idx].transform
|
&model.transform
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fn model(&self,model_id:PhysicsModelId)->&PhysicsModel{
|
fn model(&self,model_id:PhysicsModelId)->&PhysicsModel{
|
||||||
&self.models[model_id.get() as usize]
|
&self.models[&model_id]
|
||||||
}
|
}
|
||||||
fn attr(&self,model_id:PhysicsModelId)->&PhysicsCollisionAttributes{
|
fn attr(&self,model_id:PhysicsModelId)->&PhysicsCollisionAttributes{
|
||||||
&self.attributes[self.models[model_id.get() as usize].attr_id.get() as usize]
|
&self.attributes[&self.models[&model_id].attr_id]
|
||||||
}
|
}
|
||||||
fn push_mesh(&mut self,mesh:PhysicsMesh){
|
fn push_mesh(&mut self,mesh:PhysicsMesh){
|
||||||
self.meshes.push(mesh);
|
self.meshes.push(mesh);
|
||||||
@ -470,9 +470,18 @@ impl TryFrom<&gameplay_attributes::CollisionAttributes> for PhysicsCollisionAttr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(id::Id)]
|
#[derive(Hash,id::Id,Eq,PartialEq)]
|
||||||
struct PhysicsAttributesId(u32);
|
struct PhysicsAttributesId(u32);
|
||||||
|
impl Into<CollisionAttributesId> for PhysicsAttributesId{
|
||||||
|
fn into(self)->CollisionAttributesId{
|
||||||
|
CollisionAttributesId::new(self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<CollisionAttributesId> for PhysicsAttributesId{
|
||||||
|
fn from(value:CollisionAttributesId)->Self{
|
||||||
|
Self::new(value.get())
|
||||||
|
}
|
||||||
|
}
|
||||||
//unique physics meshes indexed by this
|
//unique physics meshes indexed by this
|
||||||
#[derive(Debug,Clone,Copy,Eq,Hash,PartialEq)]
|
#[derive(Debug,Clone,Copy,Eq,Hash,PartialEq)]
|
||||||
struct ConvexMeshId{
|
struct ConvexMeshId{
|
||||||
|
Loading…
Reference in New Issue
Block a user