Refactor API of libSTL
This commit is contained in:
parent
07f7165ce1
commit
174fe74939
@ -10,9 +10,10 @@ TEMPLATE = lib
|
||||
TARGET = fougdatax-c$$TARGET_SUFFIX
|
||||
DESTDIR = $$PREFIX_DIR/lib
|
||||
|
||||
DATAX = stl
|
||||
DATAX *= stl
|
||||
|
||||
dll:DEFINES *= FOUG_LIB_DLL FOUG_LIB_MAKE_DLL
|
||||
dll:DEFINES *= FOUG_LIB_DLL \
|
||||
FOUG_LIB_MAKE_DLL
|
||||
|
||||
#*g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
#*g++*:QMAKE_CXXFLAGS_RELEASE += -O3
|
||||
@ -25,7 +26,8 @@ HEADERS += \
|
||||
../../../src/c/global.h \
|
||||
../../../src/c/memory.h \
|
||||
../../../src/c/stream.h \
|
||||
../../../src/c/task_control.h
|
||||
../../../src/c/task_control.h \
|
||||
../../../src/c/transfer.h \
|
||||
|
||||
SOURCES += \
|
||||
../../../src/c/endian.c \
|
||||
@ -43,7 +45,8 @@ c_global_inc.files = ../../../src/c/*.h
|
||||
INSTALLS += global_inc c_global_inc
|
||||
|
||||
contains(DATAX, stl) {
|
||||
dll:DEFINES *= FOUG_DATAX_LIBSTL_DLL FOUG_DATAX_LIBSTL_MAKE_DLL
|
||||
dll:DEFINES *= FOUG_DATAX_LIBSTL_DLL \
|
||||
FOUG_DATAX_LIBSTL_MAKE_DLL
|
||||
|
||||
HEADERS += \
|
||||
../../../src/c/libstl/stl_global.h \
|
||||
|
@ -5,10 +5,11 @@
|
||||
|
||||
/* Common errors */
|
||||
#define FOUG_DATAX_NO_ERROR 0
|
||||
#define FOUG_DATAX_NULL_BUFFER_ERROR -1
|
||||
#define FOUG_DATAX_INVALID_BUFFER_SIZE_ERROR -2
|
||||
#define FOUG_DATAX_STREAM_ERROR -3
|
||||
#define FOUG_DATAX_TASK_STOPPED_ERROR -4
|
||||
#define FOUG_DATAX_NULL_TRANSFER_ERROR -1
|
||||
#define FOUG_DATAX_NULL_BUFFER_ERROR -2
|
||||
#define FOUG_DATAX_INVALID_BUFFER_SIZE_ERROR -3
|
||||
#define FOUG_DATAX_STREAM_ERROR -4
|
||||
#define FOUG_DATAX_TASK_STOPPED_ERROR -5
|
||||
|
||||
FOUG_LIB_EXPORT foug_bool_t foug_datax_no_error(int code);
|
||||
FOUG_LIB_EXPORT foug_bool_t foug_datax_error(int code);
|
||||
|
@ -231,27 +231,31 @@ static int eat_facet(foug_stream_fwd_iterator_t* it,
|
||||
|
||||
#define FOUG_STLA_READ_STRING_BUFFER_LEN 512
|
||||
|
||||
int foug_stla_read(foug_stla_read_args_t *args)
|
||||
int foug_stla_read(foug_stla_geom_input_t* geom,
|
||||
foug_transfer_t *trsf,
|
||||
size_t data_size_hint)
|
||||
{
|
||||
char fixed_buffer[FOUG_STLA_READ_STRING_BUFFER_LEN];
|
||||
foug_string_buffer_t string_buffer;
|
||||
foug_stream_fwd_iterator_t it;
|
||||
foug_stream_fwd_iterator_stla_cookie_t stla_cookie;
|
||||
|
||||
if (args->buffer == NULL)
|
||||
if (trsf == NULL)
|
||||
return FOUG_DATAX_NULL_TRANSFER_ERROR;
|
||||
if (trsf->buffer == NULL)
|
||||
return FOUG_DATAX_NULL_BUFFER_ERROR;
|
||||
if (args->buffer_size == 0)
|
||||
if (trsf->buffer_size == 0)
|
||||
return FOUG_DATAX_INVALID_BUFFER_SIZE_ERROR;
|
||||
|
||||
stla_cookie.task_control = &args->task_control;
|
||||
stla_cookie.stream_data_size = args->data_size_hint;
|
||||
stla_cookie.task_control = &trsf->task_control;
|
||||
stla_cookie.stream_data_size = data_size_hint;
|
||||
stla_cookie.stream_offset = 0;
|
||||
stla_cookie.is_stop_requested = 0;
|
||||
|
||||
it.stream = &(args->stream);
|
||||
it.buffer = args->buffer;
|
||||
it.stream = &(trsf->stream);
|
||||
it.buffer = trsf->buffer;
|
||||
it.buffer_offset = 0;
|
||||
it.buffer_size = args->buffer_size;
|
||||
it.buffer_size = trsf->buffer_size;
|
||||
it.cookie = &stla_cookie;
|
||||
it.stream_read_hook = foug_stream_fwd_iterator_stla_read_hook;
|
||||
foug_stream_fwd_iterator_init(&it);
|
||||
@ -268,16 +272,16 @@ int foug_stla_read(foug_stla_read_args_t *args)
|
||||
/* Try to eat solid's name */
|
||||
if (eat_string(&it, &string_buffer) != 0)
|
||||
return FOUG_STLA_READ_PARSE_ERROR;
|
||||
if (args->geom_input.begin_solid_func != NULL)
|
||||
args->geom_input.begin_solid_func(&args->geom_input, string_buffer.data);
|
||||
if (geom != NULL && geom->begin_solid_func != NULL)
|
||||
geom->begin_solid_func(geom, string_buffer.data);
|
||||
|
||||
/* Try to eat facets */
|
||||
while ((eat_facet_result = eat_facet(&it, &string_buffer, &triangle)) >= 0
|
||||
&& !stla_cookie.is_stop_requested)
|
||||
{
|
||||
if (eat_facet_result == 0) {
|
||||
if (args->geom_input.process_next_triangle_func != NULL)
|
||||
args->geom_input.process_next_triangle_func(&args->geom_input, &triangle);
|
||||
if (geom != NULL && geom->process_next_triangle_func != NULL)
|
||||
geom->process_next_triangle_func(geom, &triangle);
|
||||
}
|
||||
else {
|
||||
break; /* Ate "endsolid" */
|
||||
@ -288,8 +292,8 @@ int foug_stla_read(foug_stla_read_args_t *args)
|
||||
if (eat_facet_result > 0) {
|
||||
if (eat_string(&it, &string_buffer) != 0)
|
||||
return FOUG_STLA_READ_PARSE_ERROR;
|
||||
if (args->geom_input.end_solid_func != NULL)
|
||||
args->geom_input.end_solid_func(&args->geom_input, string_buffer.data);
|
||||
if (geom != NULL && geom->end_solid_func != NULL)
|
||||
geom->end_solid_func(geom, string_buffer.data);
|
||||
}
|
||||
else {
|
||||
return FOUG_STLA_READ_PARSE_ERROR;
|
||||
|
@ -3,17 +3,7 @@
|
||||
|
||||
#include "stl_global.h"
|
||||
#include "stl_triangle.h"
|
||||
#include "../error.h"
|
||||
#include "../stream.h"
|
||||
#include "../task_control.h"
|
||||
|
||||
/* foug_stla_read() */
|
||||
typedef struct foug_stla_read_args foug_stla_read_args_t;
|
||||
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stla_read(foug_stla_read_args_t* args);
|
||||
|
||||
/* Specific error codes returned by foug_stla_read() */
|
||||
#define FOUG_STLA_READ_PARSE_ERROR 1
|
||||
#include "../transfer.h"
|
||||
|
||||
/* foug_stla_geom_input */
|
||||
typedef struct foug_stla_geom_input foug_stla_geom_input_t;
|
||||
@ -26,15 +16,13 @@ struct foug_stla_geom_input
|
||||
/* void (*parse_error_func)(foug_stla_geom_input_t*, size_t, size_t); */
|
||||
};
|
||||
|
||||
/* foug_stla_read_args */
|
||||
struct foug_stla_read_args
|
||||
{
|
||||
foug_stla_geom_input_t geom_input;
|
||||
foug_stream_t stream;
|
||||
foug_task_control_t task_control;
|
||||
char* buffer;
|
||||
uint32_t buffer_size;
|
||||
size_t data_size_hint;
|
||||
};
|
||||
/* foug_stla_read() */
|
||||
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stla_read(foug_stla_geom_input_t* geom,
|
||||
foug_transfer_t* trsf,
|
||||
size_t data_size_hint);
|
||||
|
||||
/* Specific error codes returned by foug_stla_read() */
|
||||
#define FOUG_STLA_READ_PARSE_ERROR 1
|
||||
|
||||
#endif /* FOUG_DATAX_C_LIBSTL_STLA_READ_H */
|
||||
|
8
src/c/libstl/stla_write.c
Normal file
8
src/c/libstl/stla_write.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include "stla_write.h"
|
||||
|
||||
#include "../error.h"
|
||||
|
||||
int foug_stla_write(foug_stla_geom_output_t* geom, foug_transfer_t* trsf)
|
||||
{
|
||||
return FOUG_DATAX_NO_ERROR;
|
||||
}
|
27
src/c/libstl/stla_write.h
Normal file
27
src/c/libstl/stla_write.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef FOUG_DATAX_C_LIBSTL_STLA_WRITE_H
|
||||
#define FOUG_DATAX_C_LIBSTL_STLA_WRITE_H
|
||||
|
||||
#include "stl_global.h"
|
||||
#include "stl_triangle.h"
|
||||
#include "../transfer.h"
|
||||
|
||||
/* foug_stla_geom_output */
|
||||
typedef struct foug_stla_geom_output foug_stla_geom_output_t;
|
||||
struct foug_stla_geom_output
|
||||
{
|
||||
void* cookie;
|
||||
size_t (*get_solid_count_func)(foug_stla_geom_output_t*);
|
||||
void (*get_solid_name)(foug_stla_geom_output_t*, size_t, char*);
|
||||
size_t (*get_triangle_count_func)(foug_stla_geom_output_t*, size_t);
|
||||
void (*get_triangle_func)(foug_stla_geom_output_t*, size_t, size_t, foug_stl_triangle_t*);
|
||||
};
|
||||
|
||||
/* foug_stla_write() */
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stla_write(foug_stla_geom_output_t* geom,
|
||||
foug_transfer_t* trsf);
|
||||
|
||||
/* Specific error codes returned by foug_stla_write() */
|
||||
#define FOUG_STLA_WRITE_NULL_GET_TRIANGLE_COUNT_FUNC 1
|
||||
#define FOUG_STLB_WRITE_NULL_GET_TRIANGLE_FUNC 2
|
||||
|
||||
#endif /* FOUG_DATAX_C_LIBSTL_STLA_WRITE_H */
|
@ -3,7 +3,7 @@
|
||||
#include "../error.h"
|
||||
#include "../endian.h"
|
||||
|
||||
static void foug_stlb_read_facets(foug_stlb_geom_input_t* geom_input,
|
||||
static void foug_stlb_read_facets(foug_stlb_geom_input_t* geom,
|
||||
uint8_t* buffer,
|
||||
uint32_t facet_count)
|
||||
{
|
||||
@ -11,7 +11,7 @@ static void foug_stlb_read_facets(foug_stlb_geom_input_t* geom_input,
|
||||
uint32_t buffer_offset;
|
||||
uint32_t i_facet;
|
||||
|
||||
if (geom_input->process_next_triangle_func == NULL)
|
||||
if (geom == NULL || geom->process_next_triangle_func == NULL)
|
||||
return;
|
||||
|
||||
buffer_offset = 0;
|
||||
@ -21,50 +21,50 @@ static void foug_stlb_read_facets(foug_stlb_geom_input_t* geom_input,
|
||||
buffer_offset += FOUG_STLB_TRIANGLE_SIZE;
|
||||
|
||||
/* Declare triangle */
|
||||
geom_input->process_next_triangle_func(geom_input, &triangle);
|
||||
geom->process_next_triangle_func(geom, &triangle);
|
||||
}
|
||||
}
|
||||
|
||||
int foug_stlb_read(foug_stlb_read_args_t *args)
|
||||
int foug_stlb_read(foug_stlb_geom_input_t* geom, foug_transfer_t* trsf)
|
||||
{
|
||||
uint32_t total_facet_count;
|
||||
size_t accum_facet_count_read;
|
||||
int error;
|
||||
|
||||
if (args->buffer == NULL)
|
||||
if (trsf->buffer == NULL)
|
||||
return FOUG_DATAX_NULL_BUFFER_ERROR;
|
||||
if (args->buffer_size < FOUG_STLB_MIN_CONTENTS_SIZE)
|
||||
if (trsf->buffer_size < FOUG_STLB_MIN_CONTENTS_SIZE)
|
||||
return FOUG_DATAX_INVALID_BUFFER_SIZE_ERROR;
|
||||
|
||||
/* Read header */
|
||||
{
|
||||
uint8_t header_data[FOUG_STLB_HEADER_SIZE];
|
||||
if (foug_stream_read(&args->stream, header_data, 1, FOUG_STLB_HEADER_SIZE)
|
||||
if (foug_stream_read(&trsf->stream, header_data, 1, FOUG_STLB_HEADER_SIZE)
|
||||
!= FOUG_STLB_HEADER_SIZE)
|
||||
{
|
||||
return FOUG_STLB_READ_HEADER_WRONG_SIZE_ERROR;
|
||||
}
|
||||
if (args->geom_input.process_header_func != NULL)
|
||||
args->geom_input.process_header_func(&args->geom_input, header_data);
|
||||
if (geom != NULL && geom->process_header_func != NULL)
|
||||
geom->process_header_func(geom, header_data);
|
||||
}
|
||||
|
||||
/* Read facet count */
|
||||
if (foug_stream_read(&args->stream, args->buffer, sizeof(uint32_t), 1) != 1)
|
||||
if (foug_stream_read(&trsf->stream, trsf->buffer, sizeof(uint32_t), 1) != 1)
|
||||
return FOUG_STLB_READ_FACET_COUNT_ERROR;
|
||||
|
||||
total_facet_count = foug_decode_uint32_le(args->buffer);
|
||||
if (args->geom_input.begin_triangles_func != NULL)
|
||||
args->geom_input.begin_triangles_func(&args->geom_input, total_facet_count);
|
||||
total_facet_count = foug_decode_uint32_le(trsf->buffer);
|
||||
if (geom != NULL && geom->begin_triangles_func != NULL)
|
||||
geom->begin_triangles_func(geom, total_facet_count);
|
||||
|
||||
/* Read triangles */
|
||||
accum_facet_count_read = 0;
|
||||
error = FOUG_DATAX_NO_ERROR;
|
||||
while (foug_datax_no_error(error) && accum_facet_count_read < total_facet_count) {
|
||||
const size_t facet_count_read = foug_stream_read(&args->stream,
|
||||
args->buffer,
|
||||
const size_t facet_count_read = foug_stream_read(&trsf->stream,
|
||||
trsf->buffer,
|
||||
FOUG_STLB_TRIANGLE_SIZE,
|
||||
args->buffer_size / FOUG_STLB_TRIANGLE_SIZE);
|
||||
if (foug_stream_error(&args->stream) != 0)
|
||||
trsf->buffer_size / FOUG_STLB_TRIANGLE_SIZE);
|
||||
if (foug_stream_error(&trsf->stream) != 0)
|
||||
error = FOUG_DATAX_STREAM_ERROR;
|
||||
else if (facet_count_read > 0)
|
||||
error = FOUG_DATAX_NO_ERROR;
|
||||
@ -74,16 +74,19 @@ int foug_stlb_read(foug_stlb_read_args_t *args)
|
||||
if (foug_datax_no_error(error)) {
|
||||
uint8_t progress_pc;
|
||||
|
||||
foug_stlb_read_facets(&args->geom_input, args->buffer, facet_count_read);
|
||||
foug_stlb_read_facets(geom, trsf->buffer, facet_count_read);
|
||||
accum_facet_count_read += facet_count_read;
|
||||
progress_pc = foug_percentage(0, total_facet_count, accum_facet_count_read);
|
||||
if (!foug_task_control_handle_progress(&args->task_control, progress_pc))
|
||||
if (!foug_task_control_handle_progress(&trsf->task_control, progress_pc))
|
||||
error = FOUG_DATAX_TASK_STOPPED_ERROR;
|
||||
}
|
||||
} /* end while */
|
||||
|
||||
if (foug_datax_no_error(error) && args->geom_input.end_triangles_func != NULL)
|
||||
args->geom_input.end_triangles_func(&args->geom_input);
|
||||
if (foug_datax_no_error(error)
|
||||
&& geom != NULL && geom->end_triangles_func != NULL)
|
||||
{
|
||||
geom->end_triangles_func(geom);
|
||||
}
|
||||
|
||||
if (foug_datax_no_error(error) && accum_facet_count_read != total_facet_count)
|
||||
error = FOUG_STLB_READ_FACET_COUNT_ERROR;
|
||||
|
@ -3,18 +3,7 @@
|
||||
|
||||
#include "stl_global.h"
|
||||
#include "stlb_triangle.h"
|
||||
#include "../error.h"
|
||||
#include "../stream.h"
|
||||
#include "../task_control.h"
|
||||
|
||||
/* foug_stlb_read() */
|
||||
typedef struct foug_stlb_read_args foug_stlb_read_args_t;
|
||||
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stlb_read(foug_stlb_read_args_t* args);
|
||||
|
||||
/* Specific error codes returned by foug_stlb_read() */
|
||||
#define FOUG_STLB_READ_HEADER_WRONG_SIZE_ERROR 1
|
||||
#define FOUG_STLB_READ_FACET_COUNT_ERROR 2
|
||||
#include "../transfer.h"
|
||||
|
||||
/* foug_stlb_geom_input */
|
||||
typedef struct foug_stlb_geom_input foug_stlb_geom_input_t;
|
||||
@ -27,14 +16,12 @@ struct foug_stlb_geom_input
|
||||
void (*end_triangles_func) (foug_stlb_geom_input_t*);
|
||||
};
|
||||
|
||||
/* foug_stlb_read_args */
|
||||
struct foug_stlb_read_args
|
||||
{
|
||||
foug_stlb_geom_input_t geom_input;
|
||||
foug_stream_t stream;
|
||||
foug_task_control_t task_control;
|
||||
uint8_t* buffer;
|
||||
uint32_t buffer_size;
|
||||
};
|
||||
/* foug_stlb_read() */
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stlb_read(foug_stlb_geom_input_t* geom,
|
||||
foug_transfer_t* trsf);
|
||||
|
||||
/* Specific error codes returned by foug_stlb_read() */
|
||||
#define FOUG_STLB_READ_HEADER_WRONG_SIZE_ERROR 1
|
||||
#define FOUG_STLB_READ_FACET_COUNT_ERROR 2
|
||||
|
||||
#endif /* FOUG_DATAX_C_LIBSTL_STLB_READ_H */
|
||||
|
@ -25,7 +25,7 @@ static void foug_stlb_write_facets(const foug_stlb_geom_output_t* geom_output,
|
||||
} /* end for */
|
||||
}
|
||||
|
||||
int foug_stlb_write(foug_stlb_write_args_t *args)
|
||||
int foug_stlb_write(const foug_stlb_geom_output_t* geom, foug_transfer_t* trsf)
|
||||
{
|
||||
uint32_t facet_count;
|
||||
uint32_t i_facet;
|
||||
@ -33,37 +33,37 @@ int foug_stlb_write(foug_stlb_write_args_t *args)
|
||||
uint32_t ifacet_start;
|
||||
int error;
|
||||
|
||||
if (args->buffer == NULL)
|
||||
if (trsf->buffer == NULL)
|
||||
return FOUG_DATAX_NULL_BUFFER_ERROR;
|
||||
if (args->buffer_size < FOUG_STLB_MIN_CONTENTS_SIZE)
|
||||
if (trsf->buffer_size < FOUG_STLB_MIN_CONTENTS_SIZE)
|
||||
return FOUG_DATAX_INVALID_BUFFER_SIZE_ERROR;
|
||||
if (args->geom_output.get_triangle_count_func == NULL)
|
||||
if (geom == NULL || geom->get_triangle_count_func == NULL)
|
||||
return FOUG_STLB_WRITE_NULL_GET_TRIANGLE_COUNT_FUNC;
|
||||
if (args->geom_output.get_triangle_func == NULL)
|
||||
if (geom == NULL || geom->get_triangle_func == NULL)
|
||||
return FOUG_STLB_WRITE_NULL_GET_TRIANGLE_FUNC;
|
||||
|
||||
/* Write header */
|
||||
{
|
||||
uint8_t header_data[FOUG_STLB_HEADER_SIZE];
|
||||
if (args->geom_output.get_header_func != NULL)
|
||||
args->geom_output.get_header_func(&args->geom_output, header_data);
|
||||
if (geom->get_header_func != NULL)
|
||||
geom->get_header_func(geom, header_data);
|
||||
else
|
||||
memset(header_data, 0, FOUG_STLB_HEADER_SIZE);
|
||||
|
||||
if (foug_stream_write(&args->stream, header_data, FOUG_STLB_HEADER_SIZE, 1) != 1)
|
||||
if (foug_stream_write(&trsf->stream, header_data, FOUG_STLB_HEADER_SIZE, 1) != 1)
|
||||
return FOUG_DATAX_STREAM_ERROR;
|
||||
}
|
||||
|
||||
/* Write facet count */
|
||||
facet_count = args->geom_output.get_triangle_count_func(&args->geom_output);
|
||||
foug_encode_uint32_le(facet_count, args->buffer);
|
||||
if (foug_stream_write(&args->stream, args->buffer, sizeof(uint32_t), 1) != 1)
|
||||
facet_count = geom->get_triangle_count_func(geom);
|
||||
foug_encode_uint32_le(facet_count, trsf->buffer);
|
||||
if (foug_stream_write(&trsf->stream, trsf->buffer, sizeof(uint32_t), 1) != 1)
|
||||
return FOUG_DATAX_STREAM_ERROR;
|
||||
|
||||
/* Write triangles */
|
||||
error = FOUG_DATAX_NO_ERROR;
|
||||
|
||||
buffer_facet_count = args->buffer_size / FOUG_STLB_TRIANGLE_SIZE;
|
||||
buffer_facet_count = trsf->buffer_size / FOUG_STLB_TRIANGLE_SIZE;
|
||||
ifacet_start = 0;
|
||||
for (i_facet = 0;
|
||||
i_facet < facet_count && foug_datax_no_error(error);
|
||||
@ -72,11 +72,11 @@ int foug_stlb_write(foug_stlb_write_args_t *args)
|
||||
/* Write to buffer */
|
||||
if (buffer_facet_count > (facet_count - ifacet_start))
|
||||
buffer_facet_count = facet_count - ifacet_start;
|
||||
foug_stlb_write_facets(&args->geom_output, args->buffer, ifacet_start, buffer_facet_count);
|
||||
foug_stlb_write_facets(geom, trsf->buffer, ifacet_start, buffer_facet_count);
|
||||
ifacet_start += buffer_facet_count;
|
||||
|
||||
/* Write buffer to stream */
|
||||
if (foug_stream_write(&args->stream, args->buffer, FOUG_STLB_TRIANGLE_SIZE, buffer_facet_count)
|
||||
if (foug_stream_write(&trsf->stream, trsf->buffer, FOUG_STLB_TRIANGLE_SIZE, buffer_facet_count)
|
||||
!= buffer_facet_count)
|
||||
{
|
||||
error = FOUG_DATAX_STREAM_ERROR;
|
||||
@ -84,7 +84,7 @@ int foug_stlb_write(foug_stlb_write_args_t *args)
|
||||
|
||||
/* Task control */
|
||||
if (foug_datax_no_error(error)
|
||||
&& !foug_task_control_handle_progress(&args->task_control,
|
||||
&& !foug_task_control_handle_progress(&trsf->task_control,
|
||||
foug_percentage(0, facet_count, i_facet + 1)))
|
||||
{
|
||||
error = FOUG_DATAX_TASK_STOPPED_ERROR;
|
||||
|
@ -3,18 +3,7 @@
|
||||
|
||||
#include "stl_global.h"
|
||||
#include "stlb_triangle.h"
|
||||
#include "../error.h"
|
||||
#include "../stream.h"
|
||||
#include "../task_control.h"
|
||||
|
||||
/* foug_stlb_write() */
|
||||
typedef struct foug_stlb_write_args foug_stlb_write_args_t;
|
||||
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stlb_write(foug_stlb_write_args_t* args);
|
||||
|
||||
/* Specific error codes returned by foug_stlb_write() */
|
||||
#define FOUG_STLB_WRITE_NULL_GET_TRIANGLE_COUNT_FUNC 1
|
||||
#define FOUG_STLB_WRITE_NULL_GET_TRIANGLE_FUNC 2
|
||||
#include "../transfer.h"
|
||||
|
||||
/* foug_stlb_geom_output */
|
||||
typedef struct foug_stlb_geom_output foug_stlb_geom_output_t;
|
||||
@ -26,14 +15,12 @@ struct foug_stlb_geom_output
|
||||
void (*get_triangle_func) (const foug_stlb_geom_output_t*, uint32_t, foug_stlb_triangle_t*);
|
||||
};
|
||||
|
||||
/* foug_stlb_write_args */
|
||||
struct foug_stlb_write_args
|
||||
{
|
||||
foug_stlb_geom_output_t geom_output;
|
||||
foug_stream_t stream;
|
||||
foug_task_control_t task_control;
|
||||
uint8_t* buffer;
|
||||
uint32_t buffer_size;
|
||||
};
|
||||
/* foug_stlb_write() */
|
||||
FOUG_DATAX_LIBSTL_EXPORT int foug_stlb_write(const foug_stlb_geom_output_t* geom,
|
||||
foug_transfer_t* trsf);
|
||||
|
||||
/* Specific error codes returned by foug_stlb_write() */
|
||||
#define FOUG_STLB_WRITE_NULL_GET_TRIANGLE_COUNT_FUNC 1
|
||||
#define FOUG_STLB_WRITE_NULL_GET_TRIANGLE_FUNC 2
|
||||
|
||||
#endif /* FOUG_DATAX_C_LIBSTL_STLB_WRITE_H */
|
||||
|
16
src/c/transfer.h
Normal file
16
src/c/transfer.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef FOUG_C_TRANSFER_H
|
||||
#define FOUG_C_TRANSFER_H
|
||||
|
||||
#include "global.h"
|
||||
#include "stream.h"
|
||||
#include "task_control.h"
|
||||
|
||||
typedef struct foug_transfer
|
||||
{
|
||||
foug_stream_t stream;
|
||||
foug_task_control_t task_control;
|
||||
void* buffer;
|
||||
size_t buffer_size;
|
||||
} foug_transfer_t;
|
||||
|
||||
#endif /* FOUG_C_TRANSFER_H */
|
Loading…
Reference in New Issue
Block a user