Fix Makefile and build and update README

This commit is contained in:
msiglreith 2018-01-02 17:39:02 +01:00
parent d270a36ba3
commit bcc11fac99
3 changed files with 8 additions and 6 deletions

View file

@ -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

View file

@ -14,7 +14,7 @@ make
Build the Rust library (portability implementation):
```
cargo build -p portability
cargo build --manifest-path libportability/Cargo.toml --features <vulkan|dx12>
```
Build the native example:

View file

@ -1,7 +1,9 @@
#pragma once
const float M_PI = 3.1415926535897932;
#include <cmath>
const float pi = 3.1415926535897932;
template<typename T>
class mat4_tl
@ -85,7 +87,7 @@ template<typename T>
auto perspective(T fov, T aspect, T n, T f) -> mat4_tl<T> {
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<T>(
@ -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];
};