From bcc11fac9963ac95eacaf521d39e1d96b7ec3bff Mon Sep 17 00:00:00 2001 From: msiglreith Date: Tue, 2 Jan 2018 17:39:02 +0100 Subject: [PATCH] Fix Makefile and build and update README --- Makefile | 4 ++-- README.md | 2 +- native/math.hpp | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a01962f..11ab14b 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ BINDING=target/vulkan.rs NATIVE_DIR=target/native TARGET=$(NATIVE_DIR)/test OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o -LIBRARY=target/debug/libportability.a +LIBRARY=target/debug/libportability.so CC=g++ CFLAGS=-std=c++11 -ggdb -O0 -I$(VULKAN_DIR) @@ -20,7 +20,7 @@ $(BINDING): $(VULKAN_DIR)/vulkan/*.h bindgen --no-layout-tests --rustfmt-bindings $(VULKAN_DIR)/vulkan/vulkan.h -o $(BINDING) $(LIBRARY): libportability/src/*.rs libportability-gfx/src/*.rs Cargo.toml $(wildcard Cargo.lock) - cargo build -p portability + cargo build --manifest-path libportability/Cargo.toml --features vulkan mkdir -p target/native $(NATIVE_DIR)/%.o: native/%.cpp $(DEPS) Makefile diff --git a/README.md b/README.md index 153f37b..fbdad59 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ make Build the Rust library (portability implementation): ``` -cargo build -p portability +cargo build --manifest-path libportability/Cargo.toml --features ``` Build the native example: diff --git a/native/math.hpp b/native/math.hpp index 5165ceb..88ed5ea 100644 --- a/native/math.hpp +++ b/native/math.hpp @@ -1,7 +1,9 @@ #pragma once -const float M_PI = 3.1415926535897932; +#include + +const float pi = 3.1415926535897932; template class mat4_tl @@ -85,7 +87,7 @@ template auto perspective(T fov, T aspect, T n, T f) -> mat4_tl { assert(fov > 0); assert(aspect > 0); - const T rad = fov*T(M_PI)/T(180); + const T rad = fov*T(pi)/T(180); const T a = T(1)/(std::tan(rad/T(2))); return mat4_tl( @@ -101,7 +103,7 @@ class vec3_tl public: union { struct { T x, y, z; }; - struct { T s, t, r; }; + struct { T s, t, u; }; struct { T r, g, b; }; T data[3]; };