Blender  V2.59
BKE_material.h
Go to the documentation of this file.
00001 /*
00002  * $Id: BKE_material.h 38879 2011-07-31 11:12:38Z dfelinto $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00030 #ifndef BKE_MATERIAL_H
00031 #define BKE_MATERIAL_H
00032 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 struct Main;
00042 struct Material;
00043 struct ID;
00044 struct Object;
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(const char *name);
00054 struct Material *copy_material(struct Material *ma);
00055 struct Material *localize_material(struct Material *ma);
00056 struct Material *give_node_material(struct Material *ma); /* returns node material or self */
00057 void make_local_material(struct Material *ma);
00058 void extern_local_matarar(struct Material **matar, short totcol);
00059 
00060 void automatname(struct Material *);
00061 
00062 /* material slots */
00063 
00064 struct Material ***give_matarar(struct Object *ob);
00065 short *give_totcolp(struct Object *ob);
00066 struct Material ***give_matarar_id(struct ID *id); /* same but for ID's */
00067 short *give_totcolp_id(struct ID *id);
00068 
00069 struct Material *give_current_material(struct Object *ob, int act);
00070 struct ID *material_from(struct Object *ob, int act);
00071 void assign_material(struct Object *ob, struct Material *ma, int act);
00072 void assign_matarar(struct Object *ob, struct Material ***matar, int totcol);
00073 
00074 int find_material_index(struct Object *ob, struct Material *ma);
00075 
00076 int object_add_material_slot(struct Object *ob);
00077 int object_remove_material_slot(struct Object *ob);
00078 
00079 /* rna api */
00080 void material_append_id(struct ID *id, struct Material *ma);
00081 struct Material *material_pop_id(struct ID *id, int index, int remove_material_slot);
00082 
00083 /* rendering */
00084 
00085 void init_render_material(struct Material *, int, float *);
00086 void init_render_materials(struct Main *, int, float *);
00087 void end_render_material(struct Material *);
00088 void end_render_materials(struct Main *);
00089 
00090 int material_in_material(struct Material *parmat, struct Material *mat);
00091 
00092 void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col);
00093 
00094 /* copy/paste */
00095 void clear_matcopybuf(void);
00096 void free_matcopybuf(void);
00097 void copy_matcopybuf(struct Material *ma);
00098 void paste_matcopybuf(struct Material *ma);
00099 
00100 void clear_mat_mtex_copybuf(void);
00101 void copy_mat_mtex_copybuf(struct ID *id);
00102 void paste_mat_mtex_copybuf(struct ID *id);
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif
00109