Skip to content

Commit

Permalink
Support Haiku.
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkomandy committed Aug 18, 2018
1 parent 9cbfdd0 commit f7b42ef
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 135 deletions.
5 changes: 5 additions & 0 deletions extern/poshlib/posh.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ HP-UX C/C++ Compiler:
# define POSH_OS_STRING "FreeBSD"
#endif

#if defined __HAIKU__
# define POSH_OS_HAIKU 1
# define POSH_OS_STRING "Haiku"
#endif

#if defined __CYGWIN32__
# define POSH_OS_CYGWIN32 1
# define POSH_OS_STRING "Cygwin"
Expand Down
5 changes: 4 additions & 1 deletion src/nvcore/nvcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
#elif defined POSH_OS_FREEBSD
# define NV_OS_FREEBSD 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_HAIKU
# define NV_OS_HAIKU 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_OPENBSD
# define NV_OS_OPENBSD 1
# define NV_OS_UNIX 1
Expand Down Expand Up @@ -375,7 +378,7 @@ namespace nv {
#elif NV_CC_GNUC
# if NV_OS_LINUX
# include "DefsGnucLinux.h"
# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD || NV_OS_HAIKU
# include "DefsGnucDarwin.h"
# elif NV_OS_ORBIS
# include "DefsOrbis.h"
Expand Down
268 changes: 134 additions & 134 deletions src/thekla/thekla_atlas.h
Original file line number Diff line number Diff line change
@@ -1,134 +1,134 @@

// Thekla Atlas Generator

#if THEKLA_ATLAS_SHARED
#if _WIN32
#define DLL_EXPORT __declspec(dllexport)
#define DLL_IMPORT __declspec(dllimport)
#else
#define DLL_EXPORT
#define DLL_IMPORT
#endif
#ifdef THEKLA_ATLAS_EXPORTS
#define THEKLA_ATLAS_API DLL_EXPORT
#else
#define THEKLA_ATLAS_API DLL_IMPORT
#endif
#else
#define THEKLA_ATLAS_API
#endif


namespace Thekla {

enum Atlas_Charter {
Atlas_Charter_Witness,
Atlas_Charter_Extract,
Atlas_Charter_Default = Atlas_Charter_Witness
};

enum Atlas_Mapper {
Atlas_Mapper_LSCM,
Atlas_Mapper_Default = Atlas_Mapper_LSCM
};

enum Atlas_Packer {
Atlas_Packer_Witness,
Atlas_Packer_Default = Atlas_Packer_Witness
};

struct Atlas_Options {
Atlas_Charter charter;
union {
struct {
float proxy_fit_metric_weight;
float roundness_metric_weight;
float straightness_metric_weight;
float normal_seam_metric_weight;
float texture_seam_metric_weight;
float max_chart_area;
float max_boundary_length;
} witness;
struct {
} extract;
} charter_options;

Atlas_Mapper mapper;
union {
} mapper_options;

Atlas_Packer packer;
union {
struct {
int packing_quality;
float texel_area; // This is not really texel area, but 1 / texel width?
bool block_align; // Align charts to 4x4 blocks.
bool conservative; // Pack charts with extra padding.
} witness;
} packer_options;
};

struct Atlas_Input_Vertex {
float position[3];
float normal[3];
float uv[2];
int first_colocal;
};

struct Atlas_Input_Face {
int vertex_index[3];
int material_index;
};

struct Atlas_Input_Mesh {
int vertex_count;
int face_count;
Atlas_Input_Vertex * vertex_array;
Atlas_Input_Face * face_array;
};

struct Atlas_Output_Vertex {
float uv[2];
int xref; // Index of input vertex from which this output vertex originated.
};

struct Atlas_Output_Mesh {
int atlas_width;
int atlas_height;
int vertex_count;
int index_count;
Atlas_Output_Vertex * vertex_array;
int * index_array;
};

enum Atlas_Error {
Atlas_Error_Success,
Atlas_Error_Invalid_Args,
Atlas_Error_Invalid_Options,
Atlas_Error_Invalid_Mesh,
Atlas_Error_Invalid_Mesh_Non_Manifold,
Atlas_Error_Not_Implemented,
};

THEKLA_ATLAS_API void atlas_set_default_options(Atlas_Options * options);

THEKLA_ATLAS_API Atlas_Output_Mesh * atlas_generate(const Atlas_Input_Mesh * input, const Atlas_Options * options, Atlas_Error * error);

THEKLA_ATLAS_API void atlas_free(Atlas_Output_Mesh * output);


/*
Should we represent the input mesh with an opaque structure that simply holds pointers to the user data? That would allow us to avoid having to copy attributes to an intermediate representation.
struct Atlas_Input_Mesh;
void mesh_set_vertex_position(Atlas_Input_Mesh * mesh, float * ptr, int stride);
void mesh_set_vertex_normal(Atlas_Input_Mesh * mesh, float * ptr, int stride);
void mesh_set_vertex_uv(Mesh * mesh, float * ptr, int stride);
void mesh_set_index(Mesh * mesh, int * ptr);
*/

} // Thekla namespace


// Thekla Atlas Generator

#if THEKLA_ATLAS_SHARED
#if _WIN32
#define DLL_EXPORT __declspec(dllexport)
#define DLL_IMPORT __declspec(dllimport)
#else
#define DLL_EXPORT
#define DLL_IMPORT
#endif
#ifdef THEKLA_ATLAS_EXPORTS
#define THEKLA_ATLAS_API DLL_EXPORT
#else
#define THEKLA_ATLAS_API DLL_IMPORT
#endif
#else
#define THEKLA_ATLAS_API
#endif


namespace Thekla {

enum Atlas_Charter {
Atlas_Charter_Witness,
Atlas_Charter_Extract,
Atlas_Charter_Default = Atlas_Charter_Witness
};

enum Atlas_Mapper {
Atlas_Mapper_LSCM,
Atlas_Mapper_Default = Atlas_Mapper_LSCM
};

enum Atlas_Packer {
Atlas_Packer_Witness,
Atlas_Packer_Default = Atlas_Packer_Witness
};

struct Atlas_Options {
Atlas_Charter charter;
union {
struct {
float proxy_fit_metric_weight;
float roundness_metric_weight;
float straightness_metric_weight;
float normal_seam_metric_weight;
float texture_seam_metric_weight;
float max_chart_area;
float max_boundary_length;
} witness;
struct {
} extract;
} charter_options;

Atlas_Mapper mapper;
union {
} mapper_options;

Atlas_Packer packer;
union {
struct {
int packing_quality;
float texel_area; // This is not really texel area, but 1 / texel width?
bool block_align; // Align charts to 4x4 blocks.
bool conservative; // Pack charts with extra padding.
} witness;
} packer_options;
};

struct Atlas_Input_Vertex {
float position[3];
float normal[3];
float uv[2];
int first_colocal;
};

struct Atlas_Input_Face {
int vertex_index[3];
int material_index;
};

struct Atlas_Input_Mesh {
int vertex_count;
int face_count;
Atlas_Input_Vertex * vertex_array;
Atlas_Input_Face * face_array;
};

struct Atlas_Output_Vertex {
float uv[2];
int xref; // Index of input vertex from which this output vertex originated.
};

struct Atlas_Output_Mesh {
int atlas_width;
int atlas_height;
int vertex_count;
int index_count;
Atlas_Output_Vertex * vertex_array;
int * index_array;
};

enum Atlas_Error {
Atlas_Error_Success,
Atlas_Error_Invalid_Args,
Atlas_Error_Invalid_Options,
Atlas_Error_Invalid_Mesh,
Atlas_Error_Invalid_Mesh_Non_Manifold,
Atlas_Error_Not_Implemented,
};

THEKLA_ATLAS_API void atlas_set_default_options(Atlas_Options * options);

THEKLA_ATLAS_API Atlas_Output_Mesh * atlas_generate(const Atlas_Input_Mesh * input, const Atlas_Options * options, Atlas_Error * error);

THEKLA_ATLAS_API void atlas_free(Atlas_Output_Mesh * output);


/*
Should we represent the input mesh with an opaque structure that simply holds pointers to the user data? That would allow us to avoid having to copy attributes to an intermediate representation.
struct Atlas_Input_Mesh;
void mesh_set_vertex_position(Atlas_Input_Mesh * mesh, float * ptr, int stride);
void mesh_set_vertex_normal(Atlas_Input_Mesh * mesh, float * ptr, int stride);
void mesh_set_vertex_uv(Mesh * mesh, float * ptr, int stride);
void mesh_set_index(Mesh * mesh, int * ptr);
*/

} // Thekla namespace

0 comments on commit f7b42ef

Please sign in to comment.