Update to cgmath 0.16.1, collision 0.18.0

https://github.com/iceiix/steven/issues/4
This commit is contained in:
ice_iix 2018-10-27 18:11:26 -07:00
parent 5ce9bf3fa3
commit 80c740c1c5
11 changed files with 108 additions and 49 deletions

86
Cargo.lock generated
View File

@ -3,6 +3,11 @@ name = "adler32"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "approx"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "arrayvec"
version = "0.4.7"
@ -20,6 +25,19 @@ dependencies = [
"safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bit-set"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bit-vec"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.7.0"
@ -103,12 +121,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cgmath"
version = "0.7.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -121,11 +140,15 @@ dependencies = [
[[package]]
name = "collision"
version = "0.5.1"
source = "git+https://github.com/TheUnnamedDude/collision-rs?rev=f80825e#f80825eca687ff1053ff492e54fa782944c9cf6b"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -792,6 +815,14 @@ dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.2.6"
@ -1195,6 +1226,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "serde"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
@ -1257,8 +1301,8 @@ version = "0.0.1"
dependencies = [
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"collision 0.5.1 (git+https://github.com/TheUnnamedDude/collision-rs?rev=f80825e)",
"cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
"collision 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1282,8 +1326,8 @@ dependencies = [
name = "steven_blocks"
version = "0.0.1"
dependencies = [
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"collision 0.5.1 (git+https://github.com/TheUnnamedDude/collision-rs?rev=f80825e)",
"cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
"collision 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"steven_shared 0.0.1",
]
@ -1320,6 +1364,16 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tempdir"
version = "0.3.7"
@ -1690,8 +1744,11 @@ dependencies = [
[metadata]
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
"checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a"
"checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d"
@ -1704,9 +1761,9 @@ dependencies = [
"checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
"checksum cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75e93b3eb66e74ffb946a69ff54c6026c1399960241c843f249ea0127b96b9f6"
"checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum collision 0.5.1 (git+https://github.com/TheUnnamedDude/collision-rs?rev=f80825e)" = "<none>"
"checksum collision 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "928b2092661bb4cd6f5e5a39c639ac6553a1e69750fab6de2edb86e2304f9eaa"
"checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd"
"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980"
"checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa"
@ -1783,6 +1840,7 @@ dependencies = [
"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124"
"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e"
"checksum num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e96f040177bb3da242b5b1ecf3f54b5d5af3efbbfb18608977a5d2767b22f10"
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
"checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682"
@ -1830,6 +1888,7 @@ dependencies = [
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9"
"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"
"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce"
"checksum serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aaed41d9fb1e2f587201b863356590c90c1157495d811430a0c0325fe8169650"
"checksum sha-1 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cfd94fe9ed1245c2a1459f99373217b131a1b32b6d0922988b1e45b35249249"
@ -1839,6 +1898,7 @@ dependencies = [
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
"checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970"
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
"checksum syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)" = "baaba45c6bf60fe29aaf241fa33306c0b75c801edea8378263a8f043b09a5634"
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b"
"checksum tiff 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a2cc6c4fd13cb1cfd20abdb196e794ceccb29371855b7e7f575945f920a5b3c2"

View File

@ -23,9 +23,9 @@ rand = "0.5.5"
hex = "0.3.2"
base64 = "0.9.3"
log = "0.4.5"
cgmath = "0.7.0"
cgmath = "0.16.1"
lazy_static = "1.1.0"
collision = {git = "https://github.com/TheUnnamedDude/collision-rs", rev = "f80825e"}
collision = "0.18.0"
openssl = "0.7.8"
# clippy = "*"

View File

@ -5,8 +5,8 @@ authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
[dependencies]
lazy_static = "1.1.0"
cgmath = "0.7.0"
collision = {git = "https://github.com/TheUnnamedDude/collision-rs", rev = "f80825e"}
cgmath = "0.16.1"
collision = "0.18.0"
[dependencies.steven_shared]

View File

@ -87,7 +87,7 @@ impl ecs::System for SignRenderer {
fn entity_added(&mut self, m: &mut ecs::Manager, e: ecs::Entity, world: &mut world::World, renderer: &mut render::Renderer) {
use std::f64::consts::PI;
use cgmath::{Vector3, Matrix4, Decomposed, Rotation3, Rad, Angle, Quaternion};
use cgmath::{Vector3, Matrix4, Decomposed, Rotation3, Rad, Quaternion};
let position = *m.get_component(e, self.position).unwrap();
let info = m.get_component_mut(e, self.sign_info).unwrap();
info.dirty = false;
@ -172,7 +172,7 @@ impl ecs::System for SignRenderer {
mdl.z = position.z as f32 + 0.5;
mdl.matrix[0] = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_y(Rad::new(info.rotation as f32)),
rot: Quaternion::from_angle_y(Rad(info.rotation as f32)),
disp: Vector3::new(position.x as f32 + 0.5, -position.y as f32 - 0.5, position.z as f32 + 0.5),
}) * Matrix4::from_translation(Vector3::new(info.offset_x as f32, -info.offset_y as f32, info.offset_z as f32));
}

View File

@ -16,7 +16,7 @@ use render;
use render::model::{self, FormatState};
use types::Gamemode;
use collision::{Aabb, Aabb3};
use cgmath::{self, Point3, Vector3, Matrix4, Decomposed, Rotation3, Rad, Angle, Quaternion};
use cgmath::{self, Point3, Vector3, Matrix4, Decomposed, Rotation3, Rad, Quaternion};
use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use types::hash::FNVHash;
@ -198,7 +198,7 @@ impl ecs::System for PlayerRenderer {
};
let offset_matrix = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_y(Rad::new(PI + rotation.yaw as f32)),
rot: Quaternion::from_angle_y(Rad(PI + rotation.yaw as f32)),
disp: offset,
});
@ -207,19 +207,19 @@ impl ecs::System for PlayerRenderer {
let ang = (position.position.x - renderer.camera.pos.x).atan2(position.position.z - renderer.camera.pos.z) as f32;
mdl.matrix[PlayerModelPart::NameTag as usize] = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_y(Rad::new(ang)),
rot: Quaternion::from_angle_y(Rad(ang)),
disp: offset + Vector3::new(0.0, (-24.0/16.0) - 0.6, 0.0),
});
}
mdl.matrix[PlayerModelPart::Head as usize] = offset_matrix * Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_x(Rad::new(-rotation.pitch as f32)),
rot: Quaternion::from_angle_x(Rad(-rotation.pitch as f32)),
disp: Vector3::new(0.0, -12.0/16.0 - 12.0/16.0, 0.0),
});
mdl.matrix[PlayerModelPart::Body as usize] = offset_matrix * Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_x(Rad::new(0.0)),
rot: Quaternion::from_angle_x(Rad(0.0)),
disp: Vector3::new(0.0, -12.0/16.0 - 6.0/16.0, 0.0),
});
@ -233,12 +233,12 @@ impl ecs::System for PlayerRenderer {
mdl.matrix[PlayerModelPart::LegRight as usize] = offset_matrix * Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_x(Rad::new(ang as f32)),
rot: Quaternion::from_angle_x(Rad(ang as f32)),
disp: Vector3::new(2.0/16.0, -12.0/16.0, 0.0),
});
mdl.matrix[PlayerModelPart::LegLeft as usize] = offset_matrix * Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_x(Rad::new(-ang as f32)),
rot: Quaternion::from_angle_x(Rad(-ang as f32)),
disp: Vector3::new(-2.0/16.0, -12.0/16.0, 0.0),
});
@ -257,15 +257,15 @@ impl ecs::System for PlayerRenderer {
mdl.matrix[PlayerModelPart::ArmRight as usize] = offset_matrix * Matrix4::from_translation(
Vector3::new(6.0/16.0, -12.0/16.0-12.0/16.0, 0.0)
) * Matrix4::from(Quaternion::from_angle_x(Rad::new(-(ang * 0.75) as f32)))
* Matrix4::from(Quaternion::from_angle_z(Rad::new((i_time.cos() * 0.06 - 0.06) as f32)))
* Matrix4::from(Quaternion::from_angle_x(Rad::new((i_time.sin() * 0.06 - ((7.5 - (player_model.arm_time-7.5).abs()) / 7.5)) as f32)));
) * Matrix4::from(Quaternion::from_angle_x(Rad(-(ang * 0.75) as f32)))
* Matrix4::from(Quaternion::from_angle_z(Rad((i_time.cos() * 0.06 - 0.06) as f32)))
* Matrix4::from(Quaternion::from_angle_x(Rad((i_time.sin() * 0.06 - ((7.5 - (player_model.arm_time-7.5).abs()) / 7.5)) as f32)));
mdl.matrix[PlayerModelPart::ArmLeft as usize] = offset_matrix * Matrix4::from_translation(
Vector3::new(-6.0/16.0, -12.0/16.0-12.0/16.0, 0.0)
) * Matrix4::from(Quaternion::from_angle_x(Rad::new((ang * 0.75) as f32)))
* Matrix4::from(Quaternion::from_angle_z(Rad::new(-(i_time.cos() * 0.06 - 0.06) as f32)))
* Matrix4::from(Quaternion::from_angle_x(Rad::new(-(i_time.sin() * 0.06) as f32)));
) * Matrix4::from(Quaternion::from_angle_x(Rad((ang * 0.75) as f32)))
* Matrix4::from(Quaternion::from_angle_z(Rad(-(i_time.cos() * 0.06 - 0.06) as f32)))
* Matrix4::from(Quaternion::from_angle_x(Rad(-(i_time.sin() * 0.06) as f32)));
let mut update = true;
if position.moved {

View File

@ -4,7 +4,7 @@ use ecs;
use world;
use render;
use shared::Position as BPos;
use cgmath::EuclideanVector;
use cgmath::InnerSpace;
pub struct ApplyVelocity {
filter: ecs::Filter,
@ -115,7 +115,7 @@ impl ecs::System for UpdateLastPosition {
for e in m.find(&self.filter) {
let pos = m.get_component_mut(e, self.position).unwrap();
pos.moved = (pos.position - pos.last_position).length2() > 0.01;
pos.moved = (pos.position - pos.last_position).magnitude2() > 0.01;
pos.last_position = pos.position;
}
}
@ -157,7 +157,7 @@ impl ecs::System for LerpPosition {
let target_pos = m.get_component(e, self.target_position).unwrap();
pos.position = pos.position + (target_pos.position - pos.position) * delta * target_pos.lerp_amount;
let len = (pos.position - target_pos.position).length2() ;
let len = (pos.position - target_pos.position).magnitude2() ;
if len < 0.001 || len > 100.0 * 100.0 {
pos.position = target_pos.position;
}
@ -267,7 +267,7 @@ impl ecs::System for LightEntity {
let max_y = (pos.position.y + bounds.bounds.max.y).ceil() as i32 + 1;
let max_z = (pos.position.z + bounds.bounds.max.z).ceil() as i32 + 1;
let length = (bounds.bounds.max - bounds.bounds.min).length() as f32;
let length = (bounds.bounds.max - bounds.bounds.min).magnitude() as f32;
for y in min_y .. max_y {
for z in min_z .. max_z {

View File

@ -29,7 +29,7 @@ use image;
use image::{GenericImage, GenericImageView};
use byteorder::{WriteBytesExt, NativeEndian};
use serde_json;
use cgmath::{self, Vector, Point, SquareMatrix};
use cgmath::prelude::*;
use world;
use collision;
@ -257,7 +257,7 @@ impl Renderer {
self.perspective_matrix = cgmath::Matrix4::from(
cgmath::PerspectiveFov {
fovy: cgmath::Rad::from(cgmath::Deg{s: 90f32}),
fovy: cgmath::Rad::from(cgmath::Deg(90f32)),
aspect: (width as f32 / height as f32),
near: 0.1f32,
far: 500.0f32,

View File

@ -212,7 +212,7 @@ impl Manager {
gl::blend_func(collection.blend_s, collection.blend_d);
for model in collection.models.values() {
if model.radius > 0.0 && frustum.contains(Sphere {
if model.radius > 0.0 && frustum.contains(&Sphere {
center: Point3::new(model.x, -model.y, model.z),
radius: model.radius
}) == collision::Relation::Out {

View File

@ -27,7 +27,7 @@ use render;
use settings::Stevenkey;
use ecs;
use entity;
use cgmath::{self, Point};
use cgmath::prelude::*;
use types::Gamemode;
use shared::{Axis, Position};
use format;
@ -323,7 +323,7 @@ impl Server {
if let Some(player) = self.player {
let position = self.entities.get_component(player, self.position).unwrap();
let rotation = self.entities.get_component(player, self.rotation).unwrap();
renderer.camera.pos = cgmath::Point::from_vec(position.position + cgmath::Vector3::new(0.0, 1.62, 0.0));
renderer.camera.pos = cgmath::Point3::from_vec(position.position + cgmath::Vector3::new(0.0, 1.62, 0.0));
renderer.camera.yaw = rotation.yaw;
renderer.camera.pitch = rotation.pitch;
}
@ -344,7 +344,7 @@ impl Server {
self.world.tick(&mut self.entities);
if self.player.is_some() {
if let Some((pos, bl, _, _)) = target::trace_ray(&self.world, 4.0, renderer.camera.pos.to_vec(), renderer.view_vector.cast(), target::test_block) {
if let Some((pos, bl, _, _)) = target::trace_ray(&self.world, 4.0, renderer.camera.pos.to_vec(), renderer.view_vector.cast().unwrap(), target::test_block) {
self.target_info.update(renderer, pos, bl);
} else {
self.target_info.clear(renderer);
@ -505,7 +505,7 @@ impl Server {
pub fn on_right_click(&mut self, renderer: &mut render::Renderer) {
use shared::Direction;
if self.player.is_some() {
if let Some((pos, _, face, at)) = target::trace_ray(&self.world, 4.0, renderer.camera.pos.to_vec(), renderer.view_vector.cast(), target::test_block) {
if let Some((pos, _, face, at)) = target::trace_ray(&self.world, 4.0, renderer.camera.pos.to_vec(), renderer.view_vector.cast().unwrap(), target::test_block) {
self.write_packet(packet::play::serverbound::PlayerBlockPlacement {
location: pos,
face: protocol::VarInt(match face {

View File

@ -1,7 +1,7 @@
use render;
use render::model;
use cgmath::{Vector3, Matrix4, Decomposed, Rotation3, Rad, Angle, Quaternion};
use cgmath::{Vector3, Matrix4, Decomposed, Rotation3, Rad, Quaternion};
pub struct SunModel {
sun: model::ModelKey,
@ -38,7 +38,7 @@ impl SunModel {
let sun = renderer.model.get_model(self.sun).unwrap();
sun.matrix[0] = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_z(Rad::new(-(time * PI) as f32)),
rot: Quaternion::from_angle_z(Rad(-(time * PI) as f32)),
disp: Vector3::new(
(renderer.camera.pos.x + ox) as f32,
-(renderer.camera.pos.y + oy) as f32,
@ -51,7 +51,7 @@ impl SunModel {
let moon = renderer.model.get_model(self.moon).unwrap();
moon.matrix[0] = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_z(Rad::new((PI - (time * PI)) as f32)),
rot: Quaternion::from_angle_z(Rad((PI - (time * PI)) as f32)),
disp: Vector3::new(
(renderer.camera.pos.x - ox) as f32,
-(renderer.camera.pos.y - oy) as f32,

View File

@ -23,7 +23,7 @@ use types::hash::FNVHash;
use protocol;
use render;
use collision;
use cgmath;
use cgmath::prelude::*;
use chunk_builder;
use ecs;
use entity::block_entity;
@ -318,7 +318,6 @@ impl World {
pub fn compute_render_list(&mut self, renderer: &mut render::Renderer) {
use chunk_builder;
use cgmath::Vector;
use std::collections::VecDeque;
self.render_list.clear();
@ -347,7 +346,7 @@ impl World {
let min = cgmath::Point3::new(pos.0 as f32 * 16.0, -pos.1 as f32 * 16.0, pos.2 as f32 * 16.0);
let bounds = collision::Aabb3::new(min, min + cgmath::Vector3::new(16.0, -16.0, 16.0));
if renderer.frustum.contains(bounds) == collision::Relation::Out && from != Direction::Invalid {
if renderer.frustum.contains(&bounds) == collision::Relation::Out && from != Direction::Invalid {
continue;
}
(sec.is_some(), sec.map_or(chunk_builder::CullInfo::all_vis(), |v| v.cull_info))