From 5138e55d3eb41255b1436d40ceba134876c3c5cd Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 9 Nov 2009 15:20:58 -0500 Subject: Add support for finishes (BRDFs). --- libdimension/dimension/finishes.h | 31 +++++++++++++++++++++++++++++++ libdimension/dimension/texture.h | 27 +++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 libdimension/dimension/finishes.h (limited to 'libdimension/dimension') diff --git a/libdimension/dimension/finishes.h b/libdimension/dimension/finishes.h new file mode 100644 index 0000000..da18a6f --- /dev/null +++ b/libdimension/dimension/finishes.h @@ -0,0 +1,31 @@ +/************************************************************************* + * Copyright (C) 2009 Tavian Barnes * + * * + * This file is part of The Dimension Library. * + * * + * The Dimension Library is free software; you can redistribute it and/ * + * or modify it under the terms of the GNU Lesser General Public License * + * as published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * The Dimension Library 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 * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this program. If not, see * + * . * + *************************************************************************/ + +/* + * Custom finishes. + */ + +#ifndef DIMENSION_FINISHES_H +#define DIMENSION_FINISHES_H + +/* A specular finish */ +dmnsn_finish *dmnsn_new_specular_finish(); + +#endif /* DIMENSION_FINISHES_H */ diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h index c26e840..4d0e2d7 100644 --- a/libdimension/dimension/texture.h +++ b/libdimension/dimension/texture.h @@ -49,12 +49,39 @@ struct dmnsn_pigment { dmnsn_pigment *dmnsn_new_pigment(); void dmnsn_delete_pigment(dmnsn_pigment *pigment); +/* + * Finishes + */ + +/* Forward-declare dmnsn_finish */ +typedef struct dmnsn_finish dmnsn_finish; + +/* Finish callback */ +typedef dmnsn_color dmnsn_finish_fn(const dmnsn_finish *finish, + dmnsn_color color, dmnsn_vector x0, + dmnsn_vector normal, + dmnsn_vector reflected); + +/* dmnsn_finish definition */ +struct dmnsn_finish { + /* Callbacks */ + dmnsn_finish_fn *finish_fn; + dmnsn_free_fn *free_fn; + + /* Generic pointer */ + void *ptr; +}; + +dmnsn_finish *dmnsn_new_finish(); +void dmnsn_delete_finish(dmnsn_finish *finish); + /* * A complete texture */ typedef struct { dmnsn_pigment *pigment; + dmnsn_finish *finish; } dmnsn_texture; dmnsn_texture *dmnsn_new_texture(); -- cgit v1.2.3