commit 67e5bee26497ca080134873512e41e8e5fa419d5
parent d9f38b83f3664bc48e53f182723690f11a81c87f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 30 Jun 2016 14:45:22 +0200
Make uniform the programming style
Minor cosmetic changes on the code formatting, remove dead code and fix
the licence header of the test_ssol_utils.h file.
Diffstat:
31 files changed, 622 insertions(+), 1399 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -1,15 +1,15 @@
# Copyright (C) CNRS 2016
-#
+#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -34,7 +34,7 @@ include(rcmake_runtime)
include_directories(
${RSys_INCLUDE_DIR}
${Star3D_INCLUDE_DIR}
- )
+)
rcmake_append_runtime_dirs(_runtime_dirs RSys)
@@ -56,7 +56,7 @@ set(SSOL_FILES_SRC
ssol_shape.c
ssol_spectrum.c
ssol_sun.c)
-
+
set(SSOL_FILES_INC_API
ssol.h)
@@ -70,7 +70,7 @@ set(SSOL_FILES_INC
ssol_shape_c.h
ssol_spectrum_c.h
ssol_sun_c.h)
-
+
set(SSOL_FILES_DOC COPYING README.md)
# Prepend each file in the `SSOL_FILES_<SRC|INC>' list by `SSOL_SOURCE_DIR'
@@ -117,7 +117,7 @@ if(NOT NO_TEST)
build_test(${_name} ${ARGN})
register_test(${_name} ${_name})
endfunction()
-
+
new_test(test_ssol_device)
new_test(test_ssol_image)
new_test(test_ssol_material)
diff --git a/src/ssol.h b/src/ssol.h
@@ -129,8 +129,8 @@ struct ssol_quadric_parabolic_cylinder {
};
struct ssol_general_quadric {
+ /* Define ax^2 + 2bxy + 2cxz + 2dx + ey^2 + 2fyz + 2gy + hz^2 + 2iz + j = 0 */
double a, b, c, d, e, f, g, h, i, j;
- /* Define ax² + 2bxy + 2cxz + 2dx + ey² + 2fyz + 2gy + hz² + 2iz + j = 0 */
};
struct ssol_quadric {
diff --git a/src/ssol_image.c b/src/ssol_image.c
@@ -1,30 +1,29 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_image_c.h"
#include "ssol_device_c.h"
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
+#include <rsys/rsys.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/ref_count.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
image_release(ref_T* ref)
{
@@ -39,20 +38,16 @@ image_release(ref_T* ref)
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-/*******************************************************************************
-* Exported ssol_image functions
-******************************************************************************/
-
+ * Exported ssol_image functions
+ ******************************************************************************/
res_T
ssol_image_create
-(struct ssol_device* dev,
- struct ssol_image** out_image)
+ (struct ssol_device* dev,
+ struct ssol_image** out_image)
{
struct ssol_image* image = NULL;
res_T res = RES_OK;
+
if (!dev || !out_image) {
return RES_BAD_ARG;
}
@@ -80,8 +75,7 @@ error:
}
res_T
-ssol_image_ref_get
-(struct ssol_image* image)
+ssol_image_ref_get(struct ssol_image* image)
{
if (!image)
return RES_BAD_ARG;
@@ -90,8 +84,7 @@ ssol_image_ref_get
}
res_T
-ssol_image_ref_put
-(struct ssol_image* image)
+ssol_image_ref_put(struct ssol_image* image)
{
if (!image)
return RES_BAD_ARG;
@@ -106,11 +99,11 @@ ssol_image_setup
const size_t height,
const enum ssol_pixel_format format)
{
- if (!image
- || width <= 0
- || height <= 0
- || format < 0
- || format >= SSOL_PIXEL_FORMAT_COUNT__)
+ if(!image
+ || width <= 0
+ || height <= 0
+ || format < 0
+ || format >= SSOL_PIXEL_FORMAT_COUNT__)
return RES_BAD_ARG;
image->width = width;
@@ -118,4 +111,5 @@ ssol_image_setup
image->format = format;
return RES_OK;
-}
-\ No newline at end of file
+}
+
diff --git a/src/ssol_image_c.h b/src/ssol_image_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_IMAGE_C_H
#define SSOL_IMAGE_C_H
@@ -19,7 +19,6 @@
#include <rsys/ref_count.h>
struct ssol_image {
-
size_t width;
size_t height;
enum ssol_pixel_format format;
@@ -29,3 +28,4 @@ struct ssol_image {
};
#endif /* SSOL_IMAGE_C_H */
+
diff --git a/src/ssol_material.c b/src/ssol_material.c
@@ -1,30 +1,29 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_material_c.h"
#include "ssol_device_c.h"
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
+#include <rsys/rsys.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/ref_count.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
material_release(ref_T* ref)
{
@@ -39,20 +38,20 @@ material_release(ref_T* ref)
}
static INLINE res_T
-shader_ok(const struct ssol_mirror_shader* shader) {
- if (!shader
- || !shader->shading_normal
- || !shader->reflectivity
- || !shader->diffuse_specular_ratio
- || !shader->roughness)
+shader_ok(const struct ssol_mirror_shader* shader)
+{
+ if(!shader
+ || !shader->shading_normal
+ || !shader->reflectivity
+ || !shader->diffuse_specular_ratio
+ || !shader->roughness)
return RES_BAD_ARG;
return RES_OK;
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
+ * Local functions
+ ******************************************************************************/
static res_T
ssol_material_create
(struct ssol_device* dev,
@@ -61,10 +60,10 @@ ssol_material_create
{
struct ssol_material* material = NULL;
res_T res = RES_OK;
- if (!dev
- || !out_material
- || type < MATERIAL_FIRST_TYPE
- || type > MATERIAL_LAST_TYPE) {
+ if(!dev
+ || !out_material
+ || type < MATERIAL_FIRST_TYPE
+ || type > MATERIAL_LAST_TYPE) {
return RES_BAD_ARG;
}
@@ -92,47 +91,44 @@ error:
}
/*******************************************************************************
-* Exported ssol_material functions
-******************************************************************************/
-
+ * Exported ssol_material functions
+ ******************************************************************************/
res_T
-ssol_material_ref_get
- (struct ssol_material* material)
+ssol_material_ref_get(struct ssol_material* material)
{
if (!material)
return RES_BAD_ARG;
- ASSERT(MATERIAL_FIRST_TYPE <= material->type && material->type <= MATERIAL_LAST_TYPE);
+ ASSERT(material->type >= MATERIAL_FIRST_TYPE);
+ ASSERT(material->type <= MATERIAL_LAST_TYPE);
ref_get(&material->ref);
return RES_OK;
}
res_T
-ssol_material_ref_put
- (struct ssol_material* material)
+ssol_material_ref_put(struct ssol_material* material)
{
if (!material)
return RES_BAD_ARG;
- ASSERT(MATERIAL_FIRST_TYPE <= material->type && material->type <= MATERIAL_LAST_TYPE);
+ ASSERT(material->type >= MATERIAL_FIRST_TYPE);
+ ASSERT(material->type <= MATERIAL_LAST_TYPE);
ref_put(&material->ref, material_release);
return RES_OK;
}
res_T
ssol_material_create_mirror
- (struct ssol_device* dev,
- struct ssol_material** out_material)
+ (struct ssol_device* dev, struct ssol_material** out_material)
{
return ssol_material_create(dev, out_material, MATERIAL_MIRROR);
}
res_T
ssol_mirror_set_shader
- (struct ssol_material* material,
- const struct ssol_mirror_shader* shader)
+ (struct ssol_material* material, const struct ssol_mirror_shader* shader)
{
- if (!material
- || material->type != MATERIAL_MIRROR
- || shader_ok(shader) != RES_OK)
+ if(!material
+ || material->type != MATERIAL_MIRROR
+ || shader_ok(shader) != RES_OK)
return RES_BAD_ARG;
material->data.mirror = *shader;
@@ -142,8 +138,8 @@ ssol_mirror_set_shader
res_T
ssol_material_create_virtual
-(struct ssol_device* dev,
- struct ssol_material** out_material)
+ (struct ssol_device* dev, struct ssol_material** out_material)
{
return ssol_material_create(dev, out_material, MATERIAL_VIRTUAL);
}
+
diff --git a/src/ssol_material_c.h b/src/ssol_material_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_MATERIAL_C_H
#define SSOL_MATERIAL_C_H
diff --git a/src/ssol_object.c b/src/ssol_object.c
@@ -1,30 +1,29 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_object_c.h"
#include "ssol_device_c.h"
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
+#include <rsys/rsys.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/ref_count.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
object_release(ref_T* ref)
{
@@ -41,22 +40,18 @@ object_release(ref_T* ref)
}
static INLINE res_T
-object_ok(const struct ssol_object* object) {
- if (!object
- || !object->shape
- || !object->material)
+object_ok(const struct ssol_object* object)
+{
+ if(!object
+ || !object->shape
+ || !object->material)
return RES_BAD_ARG;
return RES_OK;
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-/*******************************************************************************
-* Exported ssol_object functions
-******************************************************************************/
-
+ * Exported ssol_object functions
+ ******************************************************************************/
res_T
ssol_object_create
(struct ssol_device* dev,
@@ -76,8 +71,8 @@ ssol_object_create
res = RES_MEM_ERR;
goto error;
}
-
- /* check if material/shape association is legit: TODO */
+
+ /* Check if material/shape association is legit: TODO */
SSOL(shape_ref_get(shape));
SSOL(material_ref_get(material));
@@ -99,8 +94,7 @@ error:
}
res_T
-ssol_object_ref_get
- (struct ssol_object* object)
+ssol_object_ref_get(struct ssol_object* object)
{
if (!object)
return RES_BAD_ARG;
@@ -109,11 +103,11 @@ ssol_object_ref_get
}
res_T
-ssol_object_ref_put
- (struct ssol_object* object)
+ssol_object_ref_put(struct ssol_object* object)
{
if (!object)
return RES_BAD_ARG;
ref_put(&object->ref, object_release);
return RES_OK;
}
+
diff --git a/src/ssol_object_c.h b/src/ssol_object_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_OBJECT_C_H
#define SSOL_OBJECT_C_H
diff --git a/src/ssol_object_instance.c b/src/ssol_object_instance.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_object_c.h"
@@ -19,14 +19,15 @@
#include "ssol_object_instance_c.h"
#include "ssol_device_c.h"
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
+#include <rsys/rsys.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/ref_count.h>
-/*******************************************************************************
-* Helper functions
-******************************************************************************/
+#include <string.h>
+/*******************************************************************************
+ * Helper functions
+ ******************************************************************************/
static void
object_instance_release(ref_T* ref)
{
@@ -45,13 +46,8 @@ object_instance_release(ref_T* ref)
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-/*******************************************************************************
-* Exported ssol_object_instance functions
-******************************************************************************/
-
+ * Exported ssol_object_instance functions
+ ******************************************************************************/
res_T
ssol_object_instantiate
(struct ssol_object* object,
@@ -90,8 +86,7 @@ error:
}
res_T
-ssol_object_instance_ref_get
- (struct ssol_object_instance* instance)
+ssol_object_instance_ref_get(struct ssol_object_instance* instance)
{
if (!instance)
return RES_BAD_ARG;
@@ -111,13 +106,12 @@ ssol_object_instance_ref_put
res_T
ssol_object_instance_set_transform
- (struct ssol_object_instance* instance,
- const double transform [])
+ (struct ssol_object_instance* instance, const double transform[])
{
if (!instance || !transform)
return RES_BAD_ARG;
- /* keep transform for later use */
+ /* Keep transform for later use */
memcpy(instance->transform, transform, sizeof(instance->transform));
return RES_OK;
@@ -129,10 +123,10 @@ ssol_object_instance_set_receiver_image
struct ssol_image* image,
const enum ssol_parametrization_type type)
{
- if (!instance
- || !image
- || (type != SSOL_PARAMETRIZATION_TEXCOORD
- && type != SSOL_PARAMETRIZATION_PRIMITIVE_ID))
+ if(!instance
+ || !image
+ || ( type != SSOL_PARAMETRIZATION_TEXCOORD
+ && type != SSOL_PARAMETRIZATION_PRIMITIVE_ID))
return RES_BAD_ARG;
if (instance->image) SSOL(image_ref_put(instance->image));
@@ -145,12 +139,11 @@ ssol_object_instance_set_receiver_image
res_T
ssol_object_instance_is_attached
- (struct ssol_object_instance* instance,
- char* is_attached)
+ (struct ssol_object_instance* instance, char* is_attached)
{
if (!instance || !is_attached)
return RES_BAD_ARG;
*is_attached = !is_list_empty(&instance->scene_attachment);
return RES_OK;
-}
-\ No newline at end of file
+}
diff --git a/src/ssol_object_instance_c.h b/src/ssol_object_instance_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_OBJECT_INSTANCE_C_H
#define SSOL_OBJECT_INSTANCE_C_H
diff --git a/src/ssol_quadric.c b/src/ssol_quadric.c
@@ -1,429 +0,0 @@
-/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "ssol.h"
-#include "ssol_quadric_c.h"
-#include "ssol_device_c.h"
-
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
-
-/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
-static void
-plane_release(ref_T* ref)
-{
- struct quadric_plane* plane;
- ASSERT(ref);
-
- plane = CONTAINER_OF(ref, struct quadric_plane, ref);
-
- ASSERT(plane->dev && plane->dev->allocator);
- MEM_RM(plane->dev->allocator, plane);
- SSOL(device_ref_put(plane->dev));
-}
-
-static void
-plane_ref_get(struct quadric_plane* plane)
-{
- ASSERT(plane);
- ref_get(&plane->ref);
-}
-
-static void
-plane_ref_put(struct quadric_plane* plane)
-{
- ASSERT(plane);
- ref_put(&plane->ref, plane_release);
-}
-
-static void
-parabol_release(ref_T* ref)
-{
- struct quadric_parabol* parabol;
- ASSERT(ref);
-
- parabol = CONTAINER_OF(ref, struct quadric_parabol, ref);
-
- ASSERT(parabol->dev && parabol->dev->allocator);
- MEM_RM(parabol->dev->allocator, parabol);
- SSOL(device_ref_put(parabol->dev));
-}
-
-static void
-parabol_ref_get(struct quadric_parabol* parabol)
-{
- ASSERT(parabol);
- ref_get(¶bol->ref);
-}
-
-static void
-parabol_ref_put(struct quadric_parabol* parabol)
-{
- ASSERT(parabol);
- ref_put(¶bol->ref, parabol_release);
-}
-
-static void
-parabolic_cylinder_release(ref_T* ref)
-{
- struct quadric_parabolic_cylinder* parabolic_cylinder;
- ASSERT(ref);
-
- parabolic_cylinder = CONTAINER_OF(ref, struct quadric_parabolic_cylinder, ref);
-
- ASSERT(parabolic_cylinder->dev && parabolic_cylinder->dev->allocator);
- MEM_RM(parabolic_cylinder->dev->allocator, parabolic_cylinder);
- SSOL(device_ref_put(parabolic_cylinder->dev));
-}
-
-static void
-parabolic_cylinder_ref_get(struct quadric_parabolic_cylinder* parabolic_cylinder)
-{
- ASSERT(parabolic_cylinder);
- ref_get(¶bolic_cylinder->ref);
-}
-
-static void
-parabolic_cylinder_ref_put(struct quadric_parabolic_cylinder* parabolic_cylinder)
-{
- ASSERT(parabolic_cylinder);
- ref_put(¶bolic_cylinder->ref, parabolic_cylinder_release);
-}
-
-static void
-quadric_release(ref_T* ref)
-{
- struct ssol_quadric* quadric;
- ASSERT(ref);
- quadric = CONTAINER_OF(ref, struct ssol_quadric, ref);
-
- switch (quadric->type) {
- case QUADRIC_NONE:
- break;
- case QUADRIC_PLANE:
- if (quadric->data.plane) plane_ref_put(quadric->data.plane);
- break;
- case QUADRIC_PARABOL:
- if (quadric->data.parabol) parabol_ref_put(quadric->data.parabol);
- break;
- case QUADRIC_PARABOLIC_CYLINDER:
- if (quadric->data.parabolic_cylinder) parabolic_cylinder_ref_put(quadric->data.parabolic_cylinder);
- break;
- default: FATAL("Unreachable code \n"); break;
- }
-
- ASSERT(quadric->dev && quadric->dev->allocator);
- MEM_RM(quadric->dev->allocator, quadric);
- SSOL(device_ref_put(quadric->dev));
-}
-
-/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-static res_T
-quadric_create(struct ssol_device* dev, struct ssol_quadric** out_quadric)
-{
- struct ssol_quadric* quadric = NULL;
- res_T res = RES_OK;
-
- ASSERT(dev && out_quadric);
-
- quadric = (struct ssol_quadric*)MEM_CALLOC
- (dev->allocator, 1, sizeof(struct ssol_quadric));
- if (!quadric) {
- res = RES_MEM_ERR;
- goto error;
- }
-
- SSOL(device_ref_get(dev));
- quadric->dev = dev;
- ref_init(&quadric->ref);
- quadric->type = QUADRIC_NONE;
-
-exit:
- if (out_quadric) *out_quadric = quadric;
- return res;
-error:
- if (quadric) {
- SSOL(quadric_ref_put(quadric));
- quadric = NULL;
- }
- goto exit;
-}
-
-static res_T
-quadric_plane_create(struct ssol_device* dev, struct quadric_plane** out_plane)
-{
- struct quadric_plane* plane = NULL;
- res_T res = RES_OK;
-
- ASSERT(dev && out_plane);
-
- plane = (struct quadric_plane*)MEM_CALLOC
- (dev->allocator, 1, sizeof(struct quadric_plane));
- if (!plane) {
- res = RES_MEM_ERR;
- goto error;
- }
-
- SSOL(device_ref_get(dev));
- plane->dev = dev;
- ref_init(&plane->ref);
-
-exit:
- if (out_plane) *out_plane = plane;
- return res;
-error:
- if (plane) {
- plane_ref_put(plane);
- plane = NULL;
- }
- goto exit;
-
-}
-
-static res_T
-quadric_parabol_create(struct ssol_device* dev, struct quadric_parabol** out_parabol)
-{
- struct quadric_parabol* parabol = NULL;
- res_T res = RES_OK;
-
- ASSERT(dev && out_parabol);
-
- parabol = (struct quadric_parabol*)MEM_CALLOC
- (dev->allocator, 1, sizeof(struct quadric_parabol));
- if (!parabol) {
- res = RES_MEM_ERR;
- goto error;
- }
-
- SSOL(device_ref_get(dev));
- parabol->dev = dev;
- ref_init(¶bol->ref);
-
-exit:
- if (out_parabol) *out_parabol = parabol;
- return res;
-error:
- if (parabol) {
- parabol_ref_put(parabol);
- parabol = NULL;
- }
- goto exit;
-
-}
-
-static res_T
-quadric_parabolic_cylinder_create(struct ssol_device* dev, struct quadric_parabolic_cylinder** out_parabolic_cylinder)
-{
- struct quadric_parabolic_cylinder* parabolic_cylinder = NULL;
- res_T res = RES_OK;
-
- ASSERT(dev && out_parabolic_cylinder);
-
- parabolic_cylinder = (struct quadric_parabolic_cylinder*)MEM_CALLOC
- (dev->allocator, 1, sizeof(struct quadric_parabolic_cylinder));
- if (!parabolic_cylinder) {
- res = RES_MEM_ERR;
- goto error;
- }
-
- SSOL(device_ref_get(dev));
- parabolic_cylinder->dev = dev;
- ref_init(¶bolic_cylinder->ref);
-
-exit:
- if (out_parabolic_cylinder) *out_parabolic_cylinder = parabolic_cylinder;
- return res;
-error:
- if (parabolic_cylinder) {
- parabolic_cylinder_ref_put(parabolic_cylinder);
- parabolic_cylinder = NULL;
- }
- goto exit;
-
-}
-
-/*******************************************************************************
-* Exported ssol_quadric functions
-******************************************************************************/
-
-res_T
-ssol_quadric_create_plane
-(struct ssol_device* dev,
- struct ssol_quadric** out_plane)
-{
- struct ssol_quadric* plane = NULL;
- res_T res = RES_OK;
-
- if (!dev || !out_plane) {
- res = RES_BAD_ARG;
- goto error;
- }
-
- res = quadric_create(dev, &plane);
- if (res != RES_OK)
- goto error;
-
- res = quadric_plane_create(dev, &plane->data.plane);
- if (res != RES_OK)
- goto error;
-
- plane->type = QUADRIC_PLANE;
- plane->dev = dev;
- ref_init(&plane->ref);
-
-exit:
- if (out_plane) *out_plane = plane;
- return res;
-error:
- if (plane) {
- SSOL(quadric_ref_put(plane));
- plane = NULL;
- }
- goto exit;
-}
-
-res_T
-ssol_quadric_create_parabol
-(struct ssol_device* dev,
- struct ssol_quadric** out_parabol)
-{
- struct ssol_quadric* parabol = NULL;
- res_T res = RES_OK;
-
- if (!dev || !out_parabol) {
- res = RES_BAD_ARG;
- goto error;
- }
-
- res = quadric_create(dev, ¶bol);
- if (res != RES_OK)
- goto error;
-
- res = quadric_parabol_create(dev, ¶bol->data.parabol);
- if (res != RES_OK)
- goto error;
-
- parabol->type = QUADRIC_PARABOL;
- parabol->data.parabol->focal = 1; /* default focal length */
- parabol->dev = dev;
- ref_init(¶bol->ref);
-
-exit:
- if (out_parabol) *out_parabol = parabol;
- return res;
-error:
- if (parabol) {
- SSOL(quadric_ref_put(parabol));
- parabol = NULL;
- }
- goto exit;
-}
-
-res_T
-ssol_quadric_create_parabolic_cylinder
-(struct ssol_device* dev,
- struct ssol_quadric** out_parabolic_cylinder)
-{
- struct ssol_quadric* parabolic_cylinder = NULL;
- res_T res = RES_OK;
-
- if (!dev || !out_parabolic_cylinder) {
- res = RES_BAD_ARG;
- goto error;
- }
-
- res = quadric_create(dev, ¶bolic_cylinder);
- if (res != RES_OK)
- goto error;
-
- res = quadric_parabolic_cylinder_create
- (dev, ¶bolic_cylinder->data.parabolic_cylinder);
- if (res != RES_OK)
- goto error;
-
- parabolic_cylinder->type = QUADRIC_PARABOLIC_CYLINDER;
- parabolic_cylinder->data.parabolic_cylinder->focal = 1; /* default focal length */
- parabolic_cylinder->dev = dev;
- ref_init(¶bolic_cylinder->ref);
-
-exit:
- if (out_parabolic_cylinder) *out_parabolic_cylinder = parabolic_cylinder;
- return res;
-error:
- if (parabolic_cylinder) {
- SSOL(quadric_ref_put(parabolic_cylinder));
- parabolic_cylinder = NULL;
- }
- goto exit;
-}
-
-res_T
-ssol_quadric_parabol_set_focal
- (struct ssol_quadric* parabol,
- double focal)
-{
- if (focal <= 0 || !parabol || parabol->type != QUADRIC_PARABOL) {
- return RES_BAD_ARG;
- }
-
- parabol->data.parabol->focal = focal;
-
- return RES_OK;
-
-}
-
- res_T
- ssol_quadric_parabolic_cylinder_set_focal
- (struct ssol_quadric* parabolic_cylinder,
- double focal)
- {
- if (focal <= 0
- || !parabolic_cylinder
- || parabolic_cylinder->type != QUADRIC_PARABOLIC_CYLINDER)
- {
- return RES_BAD_ARG;
- }
-
- parabolic_cylinder->data.parabolic_cylinder->focal = focal;
-
- return RES_OK;
- }
-
-res_T
-ssol_quadric_ref_get
-(struct ssol_quadric* quadric)
-{
- if (!quadric) return RES_BAD_ARG;
- ASSERT(QUADRIC_FIRST_TYPE <= quadric->type && quadric->type <= QUADRIC_LAST_TYPE);
- ref_get(&quadric->ref);
- return RES_OK;
-}
-
-res_T
-ssol_quadric_ref_put
-(struct ssol_quadric* quadric)
-{
- if (!quadric) return RES_BAD_ARG;
- ASSERT(QUADRIC_FIRST_TYPE <= quadric->type && quadric->type <= QUADRIC_LAST_TYPE);
- ref_put(&quadric->ref, quadric_release);
- return RES_OK;
-}
diff --git a/src/ssol_quadric_c.h b/src/ssol_quadric_c.h
@@ -1,72 +0,0 @@
-/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef SSOL_QUADRIC_C_H
-#define SSOL_QUADRIC_C_H
-
-#include <rsys/ref_count.h>
-
-enum quadric_type {
- QUADRIC_NONE,
- QUADRIC_PLANE,
- QUADRIC_PARABOL,
- QUADRIC_PARABOLIC_CYLINDER,
-
- QUADRIC_FIRST_TYPE = QUADRIC_PLANE,
- QUADRIC_LAST_TYPE = QUADRIC_PARABOLIC_CYLINDER
-};
-
-/* The following quadric definitions are in local coordinate system. */
-struct quadric_plane {
- /* local space definition is z = 0 */
- /* scene space definition */
- /* TODO */
-
- struct ssol_device* dev;
- ref_T ref;
-};
-struct quadric_parabol {
- /* local space definition: x^2 + y^2 - 4 focal z = 0 */
- double focal;
- /* scene space definition */
- /* TODO */
-
- struct ssol_device* dev;
- ref_T ref;
-};
-
-struct quadric_parabolic_cylinder {
- /* local space definition: y^2 - 4 focal z = 0 */
- double focal;
- /* scene space definition */
- /* TODO */
-
- struct ssol_device* dev;
- ref_T ref;
-};
-
-struct ssol_quadric {
- enum quadric_type type;
- union {
- struct quadric_plane* plane;
- struct quadric_parabol* parabol;
- struct quadric_parabolic_cylinder* parabolic_cylinder;
- } data;
-
- struct ssol_device* dev;
- ref_T ref;
-};
-
-#endif /* SSOL_QUADRIC_C_H */
diff --git a/src/ssol_scene.c b/src/ssol_scene.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_scene_c.h"
@@ -19,14 +19,13 @@
#include "ssol_device_c.h"
#include "ssol_object_instance_c.h"
-#include <rsys\rsys.h>
-#include <rsys\mem_allocator.h>
-#include <rsys\ref_count.h>
+#include <rsys/rsys.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/ref_count.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
scene_release(ref_T* ref)
{
@@ -58,13 +57,8 @@ scene_detach_instance
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-/*******************************************************************************
-* Exported ssol_image functions
-******************************************************************************/
-
+ * Exported ssol_image functions
+ ******************************************************************************/
res_T
ssol_scene_create
(struct ssol_device* dev,
@@ -120,15 +114,14 @@ ssol_scene_ref_put
res_T
ssol_scene_attach_object_instance
- (struct ssol_scene* scene,
- struct ssol_object_instance* instance)
+ (struct ssol_scene* scene, struct ssol_object_instance* instance)
{
if (!scene || !instance)
return RES_BAD_ARG;
if (!is_list_empty(&instance->scene_attachment))
return RES_BAD_ARG;
- /* instance is chained into the list of instance of the scene */
+ /* Instance is chained into the list of instance of the scene */
list_add_tail(&scene->instances, &instance->scene_attachment);
SSOL(object_instance_ref_get(instance));
scene->instances_count++;
@@ -164,8 +157,7 @@ ssol_scene_detach_object_instance
}
res_T
-ssol_scene_clear
- (struct ssol_scene* scene)
+ssol_scene_clear(struct ssol_scene* scene)
{
struct list_node* node, *tmp;
if (!scene) return RES_BAD_ARG;
@@ -179,9 +171,7 @@ ssol_scene_clear
}
res_T
-ssol_scene_attach_sun
- (struct ssol_scene* scene,
- struct ssol_sun* sun)
+ssol_scene_attach_sun(struct ssol_scene* scene, struct ssol_sun* sun)
{
if (!scene || ! sun || sun->scene_attachment)
return RES_BAD_ARG;
@@ -193,18 +183,15 @@ ssol_scene_attach_sun
}
res_T
-ssol_scene_detach_sun
- (struct ssol_scene* scene,
- struct ssol_sun* sun)
+ssol_scene_detach_sun(struct ssol_scene* scene, struct ssol_sun* sun)
{
if (!scene || !sun || sun->scene_attachment != scene)
return RES_BAD_ARG;
-#ifndef NDEBUG
ASSERT(sun == scene->sun);
-#endif
sun->scene_attachment = NULL;
scene->sun = NULL;
SSOL(sun_ref_put(sun));
return RES_OK;
-}
-\ No newline at end of file
+}
+
diff --git a/src/ssol_scene_c.h b/src/ssol_scene_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_SCENE_C_H
#define SSOL_SCENE_C_H
diff --git a/src/ssol_shape.c b/src/ssol_shape.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_shape_c.h"
@@ -22,9 +22,8 @@
#include <rsys/ref_count.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
shape_release(ref_T* ref)
{
@@ -40,14 +39,16 @@ shape_release(ref_T* ref)
}
static INLINE res_T
-check_plane_ok(const struct ssol_quadric_plane* plane) {
+check_plane_ok(const struct ssol_quadric_plane* plane)
+{
if (!plane)
return RES_BAD_ARG;
return RES_OK;
}
static INLINE res_T
-check_parabol_ok(const struct ssol_quadric_parabol* parabol) {
+check_parabol_ok(const struct ssol_quadric_parabol* parabol)
+{
if (!parabol || parabol->focal <= 0)
return RES_BAD_ARG;
return RES_OK;
@@ -63,95 +64,102 @@ check_parabolic_cylinder_ok
}
static INLINE res_T
-check_general_quadric_ok(const struct ssol_general_quadric* quadric) {
+check_general_quadric_ok(const struct ssol_general_quadric* quadric)
+{
if (!quadric)
return RES_BAD_ARG;
- /* we don't check that the quadric equation has solutions */
- /* in such case, the quadric is valid but has zero surface */
+ /* we don't check that the quadric equation has solutions
+ * in such case, the quadric is valid but has zero surface */
return RES_OK;
}
static INLINE res_T
-quadric_ok(const struct ssol_quadric* quadric) {
+quadric_ok(const struct ssol_quadric* quadric)
+{
if (!quadric)
return RES_BAD_ARG;
switch (quadric->type) {
- case SSOL_QUADRIC_PLANE:
- return check_plane_ok(&quadric->data.plane);
- case SSOL_QUADRIC_PARABOL:
- return check_parabol_ok(&quadric->data.parabol);
- case SSOL_QUADRIC_PARABOLIC_CYLINDER:
- return check_parabolic_cylinder_ok(&quadric->data.parabolic_cylinder);
- case SSOL_GENERAL_QUADRIC:
- return check_general_quadric_ok(&quadric->data.general_quadric);
- default: return RES_BAD_ARG;
+ case SSOL_QUADRIC_PLANE:
+ return check_plane_ok(&quadric->data.plane);
+ case SSOL_QUADRIC_PARABOL:
+ return check_parabol_ok(&quadric->data.parabol);
+ case SSOL_QUADRIC_PARABOLIC_CYLINDER:
+ return check_parabolic_cylinder_ok(&quadric->data.parabolic_cylinder);
+ case SSOL_GENERAL_QUADRIC:
+ return check_general_quadric_ok(&quadric->data.general_quadric);
+ default: return RES_BAD_ARG;
}
}
static INLINE res_T
-check_circle_ok(const struct ssol_carving_circle* circle) {
+check_circle_ok(const struct ssol_carving_circle* circle)
+{
if (!circle || circle->radius <= 0)
return RES_BAD_ARG;
return RES_OK;
}
static INLINE res_T
-check_polygon_ok(const struct ssol_carving_polygon* polygon) {
- if (!polygon
- || ! polygon->get
- || polygon->nb_vertices <= 0)
+check_polygon_ok(const struct ssol_carving_polygon* polygon)
+{
+ if(!polygon
+ || !polygon->get
+ || polygon->nb_vertices <= 0)
return RES_BAD_ARG;
- /* we don't check that the polygon defines a not empty area */
- /* in such case, the quadric is valid but can have zero surface */
+ /* we don't check that the polygon defines a not empty area
+ * in such case, the quadric is valid but can have zero surface */
return RES_OK;
}
static INLINE res_T
-check_carving_ok(const struct ssol_carving* carving) {
+check_carving_ok(const struct ssol_carving* carving)
+{
if (!carving)
return RES_BAD_ARG;
+
switch (carving->type) {
- case SSOL_CARVING_CIRCLE:
- return check_circle_ok(&carving->data.circle);
- case SSOL_CARVING_POLYGON:
- return check_polygon_ok(&carving->data.polygon);
- default: return RES_BAD_ARG;
+ case SSOL_CARVING_CIRCLE:
+ return check_circle_ok(&carving->data.circle);
+ case SSOL_CARVING_POLYGON:
+ return check_polygon_ok(&carving->data.polygon);
+ default: return RES_BAD_ARG;
}
}
static INLINE res_T
-punched_surface_ok(const struct ssol_punched_surface* punched_surface) {
+punched_surface_ok(const struct ssol_punched_surface* punched_surface)
+{
size_t i;
- if (!punched_surface
- || punched_surface->nb_carvings == 0
- || !punched_surface->carvings
- || !punched_surface->quadric
- || quadric_ok(punched_surface->quadric) != RES_OK)
+ if(!punched_surface
+ || punched_surface->nb_carvings == 0
+ || !punched_surface->carvings
+ || !punched_surface->quadric
+ || quadric_ok(punched_surface->quadric) != RES_OK)
return RES_BAD_ARG;
for (i = 0; i < punched_surface->nb_carvings; i++) {
if (check_carving_ok(&punched_surface->carvings[i]))
return RES_BAD_ARG;
}
- /* we don't check that carvings define a non empty area */
- /* in such case, the quadric is valid but has zero surface */
+ /* we don't check that carvings define a non empty area
+ * in such case, the quadric is valid but has zero surface */
return RES_OK;
}
static INLINE res_T
-shape_ok(const struct ssol_shape* shape) {
- if (!shape
- || !shape->dev
- || !shape->shape
- || SHAPE_FIRST_TYPE > shape->type
- || shape->type > SHAPE_LAST_TYPE)
+shape_ok(const struct ssol_shape* shape)
+{
+ if(!shape
+ || !shape->dev
+ || !shape->shape
+ || SHAPE_FIRST_TYPE > shape->type
+ || shape->type > SHAPE_LAST_TYPE)
return RES_BAD_ARG;
return RES_OK;
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
+ * Local functions
+ ******************************************************************************/
static res_T
shape_create
(struct ssol_device* dev,
@@ -161,10 +169,10 @@ shape_create
struct ssol_shape* shape = NULL;
res_T res = RES_OK;
- if (!dev
- || !out_shape
- || type < SHAPE_FIRST_TYPE
- || type > SHAPE_LAST_TYPE) {
+ if(!dev
+ || !out_shape
+ || type < SHAPE_FIRST_TYPE
+ || type > SHAPE_LAST_TYPE) {
return RES_BAD_ARG;
}
@@ -193,13 +201,11 @@ error:
shape = NULL;
}
goto exit;
-
}
/*******************************************************************************
-* Exported ssol_shape functions
-******************************************************************************/
-
+ * Exported ssol_shape functions
+ ******************************************************************************/
res_T
ssol_shape_create_mesh
(struct ssol_device* dev,
@@ -217,8 +223,7 @@ ssol_shape_create_punched_surface
}
res_T
-ssol_shape_ref_get
-(struct ssol_shape* shape)
+ssol_shape_ref_get(struct ssol_shape* shape)
{
if (!shape) return RES_BAD_ARG;
ASSERT(SHAPE_FIRST_TYPE <= shape->type && shape->type <= SHAPE_LAST_TYPE);
@@ -227,8 +232,7 @@ ssol_shape_ref_get
}
res_T
-ssol_shape_ref_put
-(struct ssol_shape* shape)
+ssol_shape_ref_put(struct ssol_shape* shape)
{
if (!shape) return RES_BAD_ARG;
ASSERT(SHAPE_FIRST_TYPE <= shape->type && shape->type <= SHAPE_LAST_TYPE);
@@ -244,11 +248,9 @@ ssol_punched_surface_setup
res_T res = RES_OK;
struct mem_allocator * allocator;
- if (shape_ok(shape) != RES_OK
- || shape->type != SHAPE_PUNCHED
- || punched_surface_ok(punched_surface) != RES_OK) {
- return RES_BAD_ARG;
- }
+ if((res = shape_ok(shape)) != RES_OK) return res;
+ if((res = punched_surface_ok(punched_surface)) != RES_OK) return res;
+ if(shape->type != SHAPE_PUNCHED) return RES_BAD_ARG;
ASSERT(shape->ref);
ASSERT(shape->dev && shape->dev->allocator && shape->shape);
@@ -275,13 +277,12 @@ ssol_mesh_setup
const unsigned nattribs,
void* data)
{
- struct s3d_vertex_data* _attrib3 = NULL;
+ struct s3d_vertex_data* attrib3 = NULL;
res_T res = RES_OK;
unsigned i;
- if (shape_ok(shape) != RES_OK
- || shape->type != SHAPE_MESH
- || !get_indices) {
+ if((res = shape_ok(shape)) != RES_OK) return res;
+ if(shape->type != SHAPE_MESH || !get_indices) {
return RES_BAD_ARG;
}
if (!ntris || !nverts || !attribs || !nattribs) {
@@ -290,33 +291,34 @@ ssol_mesh_setup
ASSERT(shape->ref);
ASSERT(shape->dev && shape->dev->allocator && shape->shape);
- _attrib3 = (struct s3d_vertex_data*)MEM_CALLOC
+ attrib3 = (struct s3d_vertex_data*)MEM_CALLOC
(shape->dev->allocator, nattribs, sizeof(struct s3d_vertex_data));
- if (!_attrib3) {
+ if (!attrib3) {
return RES_MEM_ERR;
}
for (i = 0; i < nattribs; i++) {
- _attrib3[i].get = attribs[i].get;
+ attrib3[i].get = attribs[i].get;
switch (attribs[i].usage) {
- case SSOL_POSITION:
- _attrib3[i].usage = S3D_POSITION;
- _attrib3[i].type = S3D_FLOAT3;
- break;
- case SSOL_NORMAL:
- _attrib3[i].usage = S3D_ATTRIB_0;
- _attrib3[i].type = S3D_FLOAT3;
- break;
- case SSOL_TEXCOORD:
- _attrib3[i].usage = S3D_ATTRIB_1;
- _attrib3[i].type = S3D_FLOAT2;
- break;
- default:
- FATAL("Unreachable code \n");
- break;
+ case SSOL_POSITION:
+ attrib3[i].usage = S3D_POSITION;
+ attrib3[i].type = S3D_FLOAT3;
+ break;
+ case SSOL_NORMAL:
+ attrib3[i].usage = S3D_ATTRIB_0;
+ attrib3[i].type = S3D_FLOAT3;
+ break;
+ case SSOL_TEXCOORD:
+ attrib3[i].usage = S3D_ATTRIB_1;
+ attrib3[i].type = S3D_FLOAT2;
+ break;
+ default:
+ FATAL("Unreachable code \n");
+ break;
}
}
- res = s3d_mesh_setup_indexed_vertices(shape->shape, ntris, get_indices, nverts, _attrib3, nattribs, data);
- MEM_RM(shape->dev->allocator, _attrib3);
+ res = s3d_mesh_setup_indexed_vertices
+ (shape->shape, ntris, get_indices, nverts, attrib3, nattribs, data);
+ MEM_RM(shape->dev->allocator, attrib3);
return res;
}
diff --git a/src/ssol_shape_c.h b/src/ssol_shape_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_SHAPE_C_H
#define SSOL_SHAPE_C_H
diff --git a/src/ssol_spectrum.c b/src/ssol_spectrum.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_spectrum_c.h"
@@ -23,9 +23,8 @@
#include <rsys/math.h>
/*******************************************************************************
-* Helper functions
-******************************************************************************/
-
+ * Helper functions
+ ******************************************************************************/
static void
spectrum_release(ref_T* ref)
{
@@ -40,17 +39,11 @@ spectrum_release(ref_T* ref)
}
/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-/*******************************************************************************
* Exported ssol_image functions
******************************************************************************/
-
res_T
ssol_spectrum_create
- (struct ssol_device* dev,
- struct ssol_spectrum** out_spectrum)
+ (struct ssol_device* dev, struct ssol_spectrum** out_spectrum)
{
struct ssol_spectrum* spectrum = NULL;
res_T res = RES_OK;
@@ -81,8 +74,7 @@ error:
}
res_T
-ssol_spectrum_ref_get
- (struct ssol_spectrum* spectrum)
+ssol_spectrum_ref_get(struct ssol_spectrum* spectrum)
{
if (!spectrum)
return RES_BAD_ARG;
@@ -91,8 +83,7 @@ ssol_spectrum_ref_get
}
res_T
-ssol_spectrum_ref_put
- (struct ssol_spectrum* spectrum)
+ssol_spectrum_ref_put(struct ssol_spectrum* spectrum)
{
if (!spectrum)
return RES_BAD_ARG;
@@ -107,11 +98,11 @@ ssol_spectrum_setup
const double* data,
const size_t nwavelength)
{
- if (!spectrum
- || nwavelength <= 0
- || !wavelengths
- || !data)
+ if(!spectrum
+ || nwavelength <= 0
+ || !wavelengths
+ || !data)
return RES_BAD_ARG;
/* TODO */
return RES_OK;
-}
-\ No newline at end of file
+}
diff --git a/src/ssol_spectrum_c.h b/src/ssol_spectrum_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_SPECTRUM_C_H
#define SSOL_SPECTRUM_C_H
@@ -20,7 +20,6 @@
#include <rsys/list.h>
struct ssol_spectrum {
-
struct ssol_device* dev;
ref_T ref;
};
diff --git a/src/ssol_sun.c b/src/ssol_sun.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "ssol_sun_c.h"
@@ -22,10 +22,11 @@
#include <rsys/ref_count.h>
#include <rsys/math.h>
-/*******************************************************************************
-* Helper functions
-******************************************************************************/
+#include <string.h>
+/*******************************************************************************
+ * Helper functions
+ ******************************************************************************/
static void
sun_release(ref_T* ref)
{
@@ -41,15 +42,9 @@ sun_release(ref_T* ref)
SSOL(device_ref_put(dev));
}
-/*******************************************************************************
-* Local functions
-******************************************************************************/
-
-res_T
-ssol_sun_create
- (struct ssol_device* dev,
- struct ssol_sun** out_sun,
- enum sun_type type)
+static res_T
+sun_create
+ (struct ssol_device* dev, struct ssol_sun** out_sun, enum sun_type type)
{
struct ssol_sun* sun = NULL;
res_T res = RES_OK;
@@ -81,36 +76,29 @@ error:
}
/*******************************************************************************
-* Exported ssol_image functions
-******************************************************************************/
-
+ * Exported ssol_image functions
+ ******************************************************************************/
res_T
-ssol_sun_create_directional
- (struct ssol_device* dev,
- struct ssol_sun** out_sun)
+ssol_sun_create_directional(struct ssol_device* dev, struct ssol_sun** out_sun)
{
- return ssol_sun_create(dev, out_sun, SUN_DIRECTIONAL);
+ return sun_create(dev, out_sun, SUN_DIRECTIONAL);
}
res_T
-ssol_sun_create_pillbox
- (struct ssol_device* dev,
- struct ssol_sun** out_sun)
+ssol_sun_create_pillbox(struct ssol_device* dev, struct ssol_sun** out_sun)
{
- return ssol_sun_create(dev, out_sun, SUN_PILLBOX);
+ return sun_create(dev, out_sun, SUN_PILLBOX);
}
res_T
ssol_sun_create_circumsolar_ratio
- (struct ssol_device* dev,
- struct ssol_sun** out_sun)
+ (struct ssol_device* dev, struct ssol_sun** out_sun)
{
- return ssol_sun_create(dev, out_sun, SUN_CSR);
+ return sun_create(dev, out_sun, SUN_CSR);
}
res_T
-ssol_sun_ref_get
-(struct ssol_sun* sun)
+ssol_sun_ref_get(struct ssol_sun* sun)
{
if (!sun)
return RES_BAD_ARG;
@@ -119,8 +107,7 @@ ssol_sun_ref_get
}
res_T
-ssol_sun_ref_put
-(struct ssol_sun* sun)
+ssol_sun_ref_put(struct ssol_sun* sun)
{
if (!sun)
return RES_BAD_ARG;
@@ -129,9 +116,7 @@ ssol_sun_ref_put
}
res_T
-ssol_sun_set_direction
- (struct ssol_sun* sun,
- const double direction[3])
+ssol_sun_set_direction(struct ssol_sun* sun, const double direction[3])
{
if (!sun || !direction)
return RES_BAD_ARG;
@@ -140,9 +125,7 @@ ssol_sun_set_direction
}
res_T
-ssol_sun_set_spectrum
- (struct ssol_sun* sun,
- struct ssol_spectrum* spectrum)
+ssol_sun_set_spectrum(struct ssol_sun* sun, struct ssol_spectrum* spectrum)
{
if (!sun || !spectrum)
return RES_BAD_ARG;
@@ -156,10 +139,10 @@ ssol_sun_set_pillbox_aperture
(struct ssol_sun* sun,
const double angle)
{
- if (!sun
- || angle <= 0
- || angle > PI * 0.5
- || sun->type != SUN_PILLBOX)
+ if(!sun
+ || angle <= 0
+ || angle > PI * 0.5
+ || sun->type != SUN_PILLBOX)
return RES_BAD_ARG;
sun->data.pillbox.aperture = angle;
return RES_OK;
@@ -170,11 +153,12 @@ ssol_sun_set_circumsolar_ratio
(struct ssol_sun* sun,
const double ratio)
{
- if (!sun
- || ratio <= 0
- || ratio >= 1
- || sun->type != SUN_CSR)
+ if(!sun
+ || ratio <= 0
+ || ratio >= 1
+ || sun->type != SUN_CSR)
return RES_BAD_ARG;
sun->data.csr.ratio = ratio;
return RES_OK;
-}
-\ No newline at end of file
+}
+
diff --git a/src/ssol_sun_c.h b/src/ssol_sun_c.h
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef SSOL_SUN_C_H
#define SSOL_SUN_C_H
diff --git a/src/test_ssol_device.c b/src/test_ssol_device.c
@@ -59,7 +59,7 @@ main(int argc, char** argv)
CHECK(ssol_device_create(&logger, &allocator, 0, 0, &dev), RES_BAD_ARG);
CHECK(ssol_device_create(&logger, &allocator, SSOL_NTHREADS_DEFAULT, 0, &dev), RES_OK);
CHECK(ssol_device_ref_put(dev), RES_OK);
-
+
logger_release(&logger);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
diff --git a/src/test_ssol_image.c b/src/test_ssol_image.c
@@ -1,26 +1,23 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
@@ -63,4 +60,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_material.c b/src/test_ssol_material.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
@@ -76,8 +76,8 @@ get_roughness
}
/*******************************************************************************
-* test main program
-******************************************************************************/
+ * Test main program
+ ******************************************************************************/
int
main(int argc, char** argv)
{
@@ -149,4 +149,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_object.c b/src/test_ssol_object.c
@@ -1,93 +1,30 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-static void
-get_shading_normal
-(struct ssol_device* dev,
- const double wavelength,
- const double P[3],
- const double Ng[3],
- const double uv[2],
- const double wo[3],
- double* val)
-{
- int i;
- (void) dev; (void) wavelength; (void) P; (void) uv; (void) wo;
- for (i = 0; i < 3; i++) val[i] = Ng[i];
-}
-
-static void
-get_reflectivity
-(struct ssol_device* dev,
- const double wavelength,
- const double P[3],
- const double Ng[3],
- const double uv[2],
- const double wo[3],
- double* val)
-{
- (void) dev; (void) wavelength; (void) P; (void) Ng; (void) uv; (void) wo;
- *val = 1;
-}
-
-static void
-get_diffuse_specular_ratio
-(struct ssol_device* dev,
- const double wavelength,
- const double P[3],
- const double Ng[3],
- const double uv[2],
- const double wo[3],
- double* val)
-{
- (void) dev; (void) wavelength; (void) P; (void) Ng; (void) uv; (void) wo;
- *val = 0;
-}
-
-static void
-get_roughness
-(struct ssol_device* dev,
- const double wavelength,
- const double P[3],
- const double Ng[3],
- const double uv[2],
- const double wo[3],
- double* val)
-{
- (void) dev; (void) wavelength; (void) P; (void) Ng; (void) uv; (void) wo;
- *val = 0;
-}
-
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
struct logger logger;
struct mem_allocator allocator;
struct ssol_device* dev;
- struct ssol_carving carving;
- struct ssol_quadric quadric;
struct ssol_shape* shape;
- struct ssol_punched_surface punched_surface;
struct ssol_material* material;
struct ssol_object* object;
(void) argc, (void) argv;
@@ -100,18 +37,7 @@ main(int argc, char** argv)
logger_set_stream(&logger, LOG_WARNING, log_stream, NULL);
CHECK(ssol_device_create(&logger, &allocator, SSOL_NTHREADS_DEFAULT, 0, &dev), RES_OK);
-
CHECK(ssol_material_create_virtual(dev, &material), RES_OK);
-
- carving.type = SSOL_CARVING_CIRCLE;
- carving.internal = 0;
- carving.data.circle.center[0] = 0;
- carving.data.circle.center[1] = 0;
- carving.data.circle.radius = 1;
- quadric.type = SSOL_QUADRIC_PLANE;
- punched_surface.nb_carvings = 1;
- punched_surface.quadric = &quadric;
- punched_surface.carvings = &carving;
CHECK(ssol_shape_create_punched_surface(dev, &shape), RES_OK);
CHECK(ssol_object_create(NULL, shape, material, &object), RES_BAD_ARG);
@@ -139,4 +65,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_object_instance.c b/src/test_ssol_object_instance.c
@@ -1,36 +1,30 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
struct logger logger;
struct mem_allocator allocator;
struct ssol_device* dev;
- struct ssol_carving carving;
- struct ssol_quadric quadric;
struct ssol_shape* shape;
- struct ssol_punched_surface punched_surface;
struct ssol_material* material;
struct ssol_object* object;
struct ssol_image* image;
@@ -49,15 +43,6 @@ main(int argc, char** argv)
CHECK(ssol_material_create_virtual(dev, &material), RES_OK);
- carving.type = SSOL_CARVING_CIRCLE;
- carving.internal = 0;
- carving.data.circle.center[0] = 0;
- carving.data.circle.center[1] = 0;
- carving.data.circle.radius = 1;
- quadric.type = SSOL_QUADRIC_PLANE;
- punched_surface.nb_carvings = 1;
- punched_surface.quadric = &quadric;
- punched_surface.carvings = &carving;
CHECK(ssol_shape_create_punched_surface(dev, &shape), RES_OK);
CHECK(ssol_object_create(dev, shape, material, &object), RES_OK);
@@ -74,10 +59,14 @@ main(int argc, char** argv)
CHECK(ssol_object_instance_set_transform(instance, transform), RES_OK);
CHECK(ssol_image_create(dev, &image), RES_OK);
- CHECK(ssol_object_instance_set_receiver_image(NULL, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image(instance, NULL, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image(instance, image, (enum ssol_parametrization_type)999), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image(instance, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_OK);
+ CHECK(ssol_object_instance_set_receiver_image
+ (NULL, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
+ CHECK(ssol_object_instance_set_receiver_image
+ (instance, NULL, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
+ CHECK(ssol_object_instance_set_receiver_image
+ (instance, image, (enum ssol_parametrization_type)999), RES_BAD_ARG);
+ CHECK(ssol_object_instance_set_receiver_image
+ (instance, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_OK);
CHECK(ssol_object_instance_ref_put(instance), RES_OK);
@@ -95,4 +84,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_quadric.c b/src/test_ssol_quadric.c
@@ -1,84 +0,0 @@
-/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "ssol.h"
-#include "test_ssol_utils.h"
-
-#include <rsys/logger.h>
-
-static void
-log_stream(const char* msg, void* ctx)
-{
- ASSERT(msg);
- (void) msg, (void) ctx;
- printf("%s\n", msg);
-}
-
-int
-main(int argc, char** argv)
-{
- struct logger logger;
- struct mem_allocator allocator;
- struct ssol_device* dev;
- struct ssol_quadric* quad;
- (void) argc, (void) argv;
-
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
-
- CHECK(logger_init(&allocator, &logger), RES_OK);
- logger_set_stream(&logger, LOG_OUTPUT, log_stream, NULL);
- logger_set_stream(&logger, LOG_ERROR, log_stream, NULL);
- logger_set_stream(&logger, LOG_WARNING, log_stream, NULL);
-
- CHECK(ssol_device_create(&logger, &allocator, SSOL_NTHREADS_DEFAULT, 0, &dev), RES_OK);
-
- CHECK(ssol_quadric_create_plane(NULL, &quad), RES_BAD_ARG);
- CHECK(ssol_quadric_create_plane(dev, NULL), RES_BAD_ARG);
- CHECK(ssol_quadric_create_plane(dev, &quad), RES_OK);
- CHECK(ssol_quadric_parabol_set_focal(quad, 1), RES_BAD_ARG);
- CHECK(ssol_quadric_parabolic_cylinder_set_focal(quad, 1), RES_BAD_ARG);
- CHECK(ssol_quadric_ref_get(quad), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
-
- CHECK(ssol_quadric_create_parabol(NULL, &quad), RES_BAD_ARG);
- CHECK(ssol_quadric_create_parabol(dev, NULL), RES_BAD_ARG);
- CHECK(ssol_quadric_create_parabol(dev, &quad), RES_OK);
- CHECK(ssol_quadric_ref_get(quad), RES_OK);
- CHECK(ssol_quadric_parabolic_cylinder_set_focal(quad, 1), RES_BAD_ARG);
- CHECK(ssol_quadric_parabol_set_focal(quad, -1), RES_BAD_ARG);
- CHECK(ssol_quadric_parabol_set_focal(quad, 100), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
-
- CHECK(ssol_quadric_create_parabolic_cylinder(NULL, &quad), RES_BAD_ARG);
- CHECK(ssol_quadric_create_parabolic_cylinder(dev, NULL), RES_BAD_ARG);
- CHECK(ssol_quadric_create_parabolic_cylinder(dev, &quad), RES_OK);
- CHECK(ssol_quadric_ref_get(quad), RES_OK);
- CHECK(ssol_quadric_parabol_set_focal(quad, 1), RES_BAD_ARG);
- CHECK(ssol_quadric_parabolic_cylinder_set_focal(quad, -1), RES_BAD_ARG);
- CHECK(ssol_quadric_parabolic_cylinder_set_focal(quad, 100), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
- CHECK(ssol_quadric_ref_put(quad), RES_OK);
-
- CHECK(ssol_device_ref_put(dev), RES_OK);
-
- logger_release(&logger);
-
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
- return 0;
-}
diff --git a/src/test_ssol_scene.c b/src/test_ssol_scene.c
@@ -1,36 +1,30 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
struct logger logger;
struct mem_allocator allocator;
struct ssol_device* dev;
- struct ssol_carving carving;
- struct ssol_quadric quadric;
struct ssol_shape* shape;
- struct ssol_punched_surface punched_surface;
struct ssol_material* material;
struct ssol_object* object;
struct ssol_object_instance* instance;
@@ -50,15 +44,6 @@ main(int argc, char** argv)
CHECK(ssol_material_create_virtual(dev, &material), RES_OK);
- carving.type = SSOL_CARVING_CIRCLE;
- carving.internal = 0;
- carving.data.circle.center[0] = 0;
- carving.data.circle.center[1] = 0;
- carving.data.circle.radius = 1;
- quadric.type = SSOL_QUADRIC_PLANE;
- punched_surface.nb_carvings = 1;
- punched_surface.quadric = &quadric;
- punched_surface.carvings = &carving;
CHECK(ssol_shape_create_punched_surface(dev, &shape), RES_OK);
CHECK(ssol_object_create(dev, shape, material, &object), RES_OK);
CHECK(ssol_object_instantiate(object, &instance), RES_OK);
@@ -112,4 +97,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_shape.c b/src/test_ssol_shape.c
@@ -1,17 +1,17 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
@@ -19,14 +19,14 @@
#include <rsys/logger.h>
/*******************************************************************************
-* Box
-******************************************************************************/
-struct cbox_desc {
+ * Box
+ ******************************************************************************/
+struct desc {
const float* vertices;
const unsigned* indices;
};
-static const float cbox_walls [] = {
+static const float walls [] = {
552.f, 0.f, 0.f,
0.f, 0.f, 0.f,
0.f, 559.f, 0.f,
@@ -36,27 +36,27 @@ static const float cbox_walls [] = {
0.f, 559.f, 548.f,
552.f, 559.f, 548.f
};
-const unsigned cbox_walls_nverts = sizeof(cbox_walls) / sizeof(float[3]);
+const unsigned walls_nverts = sizeof(walls) / sizeof(float[3]);
-const unsigned cbox_walls_ids [] = {
+const unsigned walls_ids [] = {
0, 1, 2, 2, 3, 0, /* Bottom */
4, 5, 6, 6, 7, 4, /* Top */
1, 2, 6, 6, 5, 1, /* Left */
0, 3, 7, 7, 4, 0, /* Right */
2, 3, 7, 7, 6, 2 /* Back */
};
-const unsigned cbox_walls_ntris = sizeof(cbox_walls_ids) / sizeof(unsigned[3]);
+const unsigned walls_ntris = sizeof(walls_ids) / sizeof(unsigned[3]);
-static const struct cbox_desc cbox_walls_desc = { cbox_walls, cbox_walls_ids };
+static const struct desc walls_desc = { walls, walls_ids };
/*******************************************************************************
-* Callbacks
-******************************************************************************/
+ * Callbacks
+ ******************************************************************************/
static INLINE void
-cbox_get_ids(const unsigned itri, unsigned ids[3], void* data)
+get_ids(const unsigned itri, unsigned ids[3], void* data)
{
const unsigned id = itri * 3;
- struct cbox_desc* desc = data;
+ struct desc* desc = data;
NCHECK(desc, NULL);
ids[0] = desc->indices[id + 0];
ids[1] = desc->indices[id + 1];
@@ -64,9 +64,9 @@ cbox_get_ids(const unsigned itri, unsigned ids[3], void* data)
}
static INLINE void
-cbox_get_position(const unsigned ivert, float position[3], void* data)
+get_position(const unsigned ivert, float position[3], void* data)
{
- struct cbox_desc* desc = data;
+ struct desc* desc = data;
NCHECK(desc, NULL);
position[0] = desc->vertices[ivert * 3 + 0];
position[1] = desc->vertices[ivert * 3 + 1];
@@ -74,7 +74,7 @@ cbox_get_position(const unsigned ivert, float position[3], void* data)
}
static INLINE void
-cbox_get_normal(const unsigned ivert, float normal[3], void* data)
+get_normal(const unsigned ivert, float normal[3], void* data)
{
(void) ivert, (void) data;
normal[0] = 1.f;
@@ -83,7 +83,7 @@ cbox_get_normal(const unsigned ivert, float normal[3], void* data)
}
static INLINE void
-cbox_get_uv(const unsigned ivert, float uv[2], void* data)
+get_uv(const unsigned ivert, float uv[2], void* data)
{
(void) ivert, (void) data;
uv[0] = -1.f;
@@ -99,8 +99,8 @@ get_polygon_vertices(const size_t ivert, double position[2], void* ctx)
}
/*******************************************************************************
-* test main program
-******************************************************************************/
+ * Test main program
+ ******************************************************************************/
int
main(int argc, char** argv)
{
@@ -109,7 +109,7 @@ main(int argc, char** argv)
struct ssol_device* dev;
struct ssol_shape* shape;
struct ssol_vertex_data attribs[3];
- void* data = (void*) &cbox_walls_desc;
+ void* data = (void*) &walls_desc;
struct ssol_punched_surface punched_surface;
struct ssol_carving carving;
struct ssol_quadric quadric;
@@ -136,19 +136,26 @@ main(int argc, char** argv)
CHECK(ssol_shape_ref_put(shape), RES_OK);
attribs[0].usage = SSOL_POSITION;
- attribs[0].get = cbox_get_position;
+ attribs[0].get = get_position;
attribs[1].usage = SSOL_NORMAL;
- attribs[1].get = cbox_get_normal;
+ attribs[1].get = get_normal;
attribs[2].usage = SSOL_TEXCOORD;
- attribs[2].get = cbox_get_uv;
-
- CHECK(ssol_mesh_setup(NULL, cbox_walls_ntris, cbox_get_ids, cbox_walls_nverts, attribs, 1, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, 0, cbox_get_ids, cbox_walls_nverts, attribs, 1, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, cbox_walls_ntris, NULL, cbox_walls_nverts, attribs, 1, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, cbox_walls_ntris, cbox_get_ids, 0, attribs, 1, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, cbox_walls_ntris, cbox_get_ids, cbox_walls_nverts, NULL, 1, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, cbox_walls_ntris, cbox_get_ids, cbox_walls_nverts, attribs, 0, data), RES_BAD_ARG);
- CHECK(ssol_mesh_setup(shape, cbox_walls_ntris, cbox_get_ids, cbox_walls_nverts, attribs, 3, data), RES_OK);
+ attribs[2].get = get_uv;
+
+ CHECK(ssol_mesh_setup
+ (NULL, walls_ntris, get_ids, walls_nverts, attribs, 1, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, 0, get_ids, walls_nverts, attribs, 1, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, walls_ntris, NULL, walls_nverts, attribs, 1, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, walls_ntris, get_ids, 0, attribs, 1, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, walls_ntris, get_ids, walls_nverts, NULL, 1, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, walls_ntris, get_ids, walls_nverts, attribs, 0, data), RES_BAD_ARG);
+ CHECK(ssol_mesh_setup
+ (shape, walls_ntris, get_ids, walls_nverts, attribs, 3, data), RES_OK);
CHECK(ssol_shape_ref_put(shape), RES_OK);
@@ -242,4 +249,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_spectrum.c b/src/test_ssol_spectrum.c
@@ -1,26 +1,23 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
@@ -68,4 +65,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_sun.c b/src/test_ssol_sun.c
@@ -1,26 +1,23 @@
/* Copyright (C) CNRS 2016
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "ssol.h"
#include "test_ssol_utils.h"
#include <rsys/logger.h>
-/*******************************************************************************
-* test main program
-******************************************************************************/
int
main(int argc, char** argv)
{
@@ -143,4 +140,4 @@ main(int argc, char** argv)
CHECK(mem_allocated_size(), 0);
return 0;
-}
-\ No newline at end of file
+}
diff --git a/src/test_ssol_utils.h b/src/test_ssol_utils.h
@@ -1,37 +1,20 @@
-/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+/* Copyright (C) CNRS 2016
*
- * This software is a computer program whose purpose is to describe a
- * virtual 3D environment that can be ray-traced and sampled both robustly
- * and efficiently.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This software is governed by the CeCILL license under French law and
- * abiding by the rules of distribution of free software. You can use,
- * modify and/or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "http://www.cecill.info".
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * As a counterpart to the access to the source code and rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty and the software's author, the holder of the
- * economic rights, and the successive licensors have only limited
- * liability.
- *
- * In this respect, the user's attention is drawn to the risks associated
- * with loading, using, modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean that it is complicated to manipulate, and that also
- * therefore means that it is reserved for developers and experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and, more generally, to use and operate it in the
- * same conditions as regards security.
- *
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms. */
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef TEST_S3D_UTILS_H
-#define TEST_S3D_UTILS_H
+#ifndef TEST_SSOL_UTILS_H
+#define TEST_SSOL_UTILS_H
#include <rsys/mem_allocator.h>
#include <stdio.h>
@@ -55,4 +38,4 @@ check_memory_allocator(struct mem_allocator* allocator)
}
}
-#endif /* TEST_S3D_UTILS_H */
+#endif /* TEST_SSOL_UTILS_H */