From 2b211221c83bc947f3fec620cbabba8907078279 Mon Sep 17 00:00:00 2001 From: Arthur Brainville Date: Tue, 20 Feb 2018 21:40:55 +0100 Subject: [PATCH] Add double type vector. Remove by default byte_stride value Signed-off-by: Arthur Brainville (Ybalrid) --- examples/raytrace/gltf-loader.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/raytrace/gltf-loader.h b/examples/raytrace/gltf-loader.h index e20609c..b98ff33 100644 --- a/examples/raytrace/gltf-loader.h +++ b/examples/raytrace/gltf-loader.h @@ -26,7 +26,7 @@ struct arrayAdapter { /// \param ptr Pointer to the start of the data, with offset applied /// \param count Number of elements in the array /// \param byte_stride Stride betweens elements in the array - arrayAdapter(const unsigned char *ptr, size_t count, size_t byte_stride = 1) + arrayAdapter(const unsigned char *ptr, size_t count, size_t byte_stride) : dataPtr(ptr), elemCount(count), stride(byte_stride) {} /// Returns a *copy* of a single element. Can't be used to modify it. @@ -120,6 +120,22 @@ struct v4fArray { size_t size() const { return adapter.elemCount; } }; +struct v3dArray { + arrayAdapter adapter; + v3dArray(const arrayAdapter &a) : adapter(a) {} + + v3d operator[](size_t position) const { return adapter[position]; } + size_t size() const { return adapter.elemCount; } +}; + +struct v4dArray { + arrayAdapter adapter; + v4dArray(const arrayAdapter &a) : adapter(a) {} + + v4d operator[](size_t position) const { return adapter[position]; } + size_t size() const { return adapter.elemCount; } +}; + /// /// Loads glTF 2.0 mesh ///