Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00028 #ifndef BKE_MATERIAL_H 00029 #define BKE_MATERIAL_H 00030 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 struct Main; 00040 struct Material; 00041 struct ID; 00042 struct Object; 00043 struct Mesh; 00044 struct MTFace; 00045 00046 /* materials */ 00047 00048 void init_def_material(void); 00049 void free_material(struct Material *sc); 00050 void test_object_materials(struct ID *id); 00051 void resize_object_material(struct Object *ob, const short totcol); 00052 void init_material(struct Material *ma); 00053 struct Material *add_material_main(struct Main *main, const char *name); 00054 struct Material *add_material(const char *name); 00055 struct Material *copy_material(struct Material *ma); 00056 struct Material *localize_material(struct Material *ma); 00057 struct Material *give_node_material(struct Material *ma); /* returns node material or self */ 00058 void make_local_material(struct Material *ma); 00059 void extern_local_matarar(struct Material **matar, short totcol); 00060 00061 void automatname(struct Material *); 00062 00063 /* material slots */ 00064 00065 struct Material ***give_matarar(struct Object *ob); 00066 short *give_totcolp(struct Object *ob); 00067 struct Material ***give_matarar_id(struct ID *id); /* same but for ID's */ 00068 short *give_totcolp_id(struct ID *id); 00069 00070 struct Material *give_current_material(struct Object *ob, short act); 00071 struct ID *material_from(struct Object *ob, short act); 00072 void assign_material_id(struct ID *id, struct Material *ma, short act); 00073 void assign_material(struct Object *ob, struct Material *ma, short act); 00074 void assign_matarar(struct Object *ob, struct Material ***matar, short totcol); 00075 00076 short find_material_index(struct Object *ob, struct Material *ma); 00077 00078 int object_add_material_slot(struct Object *ob); 00079 int object_remove_material_slot(struct Object *ob); 00080 00081 /* rna api */ 00082 void material_append_id(struct ID *id, struct Material *ma); 00083 struct Material *material_pop_id(struct ID *id, int index, int remove_material_slot); /* index is an int because of RNA */ 00084 00085 /* rendering */ 00086 00087 void init_render_material(struct Material *, int, float *); 00088 void init_render_materials(struct Main *, int, float *); 00089 void end_render_material(struct Material *); 00090 void end_render_materials(struct Main *); 00091 00092 int material_in_material(struct Material *parmat, struct Material *mat); 00093 00094 void ramp_blend(int type, float r_col[3], const float fac, const float col[3]); 00095 00096 /* copy/paste */ 00097 void clear_matcopybuf(void); 00098 void free_matcopybuf(void); 00099 void copy_matcopybuf(struct Material *ma); 00100 void paste_matcopybuf(struct Material *ma); 00101 00102 void clear_mat_mtex_copybuf(void); 00103 void copy_mat_mtex_copybuf(struct ID *id); 00104 void paste_mat_mtex_copybuf(struct ID *id); 00105 00106 /* handle backward compatibility for tface/materials called from doversion (fileload=1) or Help Menu (fileload=0) */ 00107 int do_version_tface(struct Main *main, int fileload); 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 00113 #endif 00114