forked from bartvdbraak/blender
svn merge -rr40148:40166 https://svn.blender.org/svnroot/bf-blender/trunk/blender
This commit is contained in:
commit
a04003d648
@ -702,7 +702,7 @@ elseif(WIN32)
|
|||||||
${LIBDIR}/opencollada/lib/ftoa.lib
|
${LIBDIR}/opencollada/lib/ftoa.lib
|
||||||
${LIBDIR}/opencollada/lib/UTF.lib
|
${LIBDIR}/opencollada/lib/UTF.lib
|
||||||
)
|
)
|
||||||
set(PCRE_LIB
|
set(PCRE_LIBRARIES
|
||||||
${LIBDIR}/opencollada/lib/pcre.lib
|
${LIBDIR}/opencollada/lib/pcre.lib
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@ -844,7 +844,7 @@ elseif(WIN32)
|
|||||||
)
|
)
|
||||||
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
|
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
|
||||||
set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
|
set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
|
||||||
set(PCRE_LIB pcre)
|
set(PCRE_LIBRARIES pcre)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CODEC_FFMPEG)
|
if(WITH_CODEC_FFMPEG)
|
||||||
@ -1066,7 +1066,7 @@ elseif(APPLE)
|
|||||||
#pcre is bundled with openCollada
|
#pcre is bundled with openCollada
|
||||||
#set(PCRE ${LIBDIR}/pcre)
|
#set(PCRE ${LIBDIR}/pcre)
|
||||||
#set(PCRE_LIBPATH ${PCRE}/lib)
|
#set(PCRE_LIBPATH ${PCRE}/lib)
|
||||||
set(PCRE_LIB pcre)
|
set(PCRE_LIBRARIES pcre)
|
||||||
#libxml2 is used
|
#libxml2 is used
|
||||||
#set(EXPAT ${LIBDIR}/expat)
|
#set(EXPAT ${LIBDIR}/expat)
|
||||||
#set(EXPAT_LIBPATH ${EXPAT}/lib)
|
#set(EXPAT_LIBPATH ${EXPAT}/lib)
|
||||||
|
@ -295,10 +295,10 @@ macro(setup_liblinks
|
|||||||
target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
|
target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
|
||||||
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
||||||
|
|
||||||
file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d")
|
file_list_suffix(PCRE_LIBRARIES_DEBUG "${PCRE_LIBRARIES}" "_d")
|
||||||
target_link_libraries_debug(${target} "${PCRE_LIB_DEBUG}")
|
target_link_libraries_debug(${target} "${PCRE_LIBRARIES_DEBUG}")
|
||||||
target_link_libraries_optimized(${target} "${PCRE_LIB}")
|
target_link_libraries_optimized(${target} "${PCRE_LIBRARIES}")
|
||||||
unset(PCRE_LIB_DEBUG)
|
unset(PCRE_LIBRARIES_DEBUG)
|
||||||
|
|
||||||
if(EXPAT_LIB)
|
if(EXPAT_LIB)
|
||||||
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
||||||
@ -309,7 +309,8 @@ macro(setup_liblinks
|
|||||||
else()
|
else()
|
||||||
target_link_libraries(${target}
|
target_link_libraries(${target}
|
||||||
${OPENCOLLADA_LIBRARIES}
|
${OPENCOLLADA_LIBRARIES}
|
||||||
${PCRE_LIB}
|
${PCRE_LIBRARIES}
|
||||||
|
${XML2_LIBRARIES}
|
||||||
${EXPAT_LIB})
|
${EXPAT_LIB})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -100,7 +100,8 @@ void blf_font_size(FontBLF *font, int size, int dpi)
|
|||||||
static void blf_font_ensure_ascii_table(FontBLF *font)
|
static void blf_font_ensure_ascii_table(FontBLF *font)
|
||||||
{
|
{
|
||||||
/* build ascii on demand */
|
/* build ascii on demand */
|
||||||
if(font->glyph_ascii_table['0']==NULL) {
|
if(font->glyph_cache->glyph_ascii_table['0']==NULL) {
|
||||||
|
GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||||
GlyphBLF *g;
|
GlyphBLF *g;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i=0; i<256; i++) {
|
for(i=0; i<256; i++) {
|
||||||
@ -109,7 +110,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
|
|||||||
FT_UInt glyph_index= FT_Get_Char_Index(font->face, i);
|
FT_UInt glyph_index= FT_Get_Char_Index(font->face, i);
|
||||||
g= blf_glyph_add(font, glyph_index, i);
|
g= blf_glyph_add(font, glyph_index, i);
|
||||||
}
|
}
|
||||||
font->glyph_ascii_table[i]= g;
|
glyph_ascii_table[i]= g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,9 +123,9 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
|
|||||||
/* Note,
|
/* Note,
|
||||||
* blf_font_ensure_ascii_table(font); must be called before this macro */
|
* blf_font_ensure_ascii_table(font); must be called before this macro */
|
||||||
|
|
||||||
#define BLF_UTF8_NEXT_FAST(font, g, str, i, c) \
|
#define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \
|
||||||
if(((c)= (str)[i]) < 0x80) { \
|
if(((c)= (str)[i]) < 0x80) { \
|
||||||
g= (font)->glyph_ascii_table[c]; \
|
g= glyph_ascii_table[c]; \
|
||||||
i++; \
|
i++; \
|
||||||
} \
|
} \
|
||||||
else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \
|
else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \
|
||||||
@ -143,9 +144,11 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
|
|||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
int has_kerning, st;
|
int has_kerning, st;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
GlyphBLF **glyph_ascii_table;
|
||||||
|
|
||||||
if (!font->glyph_cache)
|
if (!font->glyph_cache)
|
||||||
return;
|
return;
|
||||||
|
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||||
|
|
||||||
i= 0;
|
i= 0;
|
||||||
pen_x= 0;
|
pen_x= 0;
|
||||||
@ -157,7 +160,7 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
|
|||||||
|
|
||||||
while (str[i] && i < len) {
|
while (str[i] && i < len) {
|
||||||
|
|
||||||
BLF_UTF8_NEXT_FAST(font, g, str, i, c);
|
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
||||||
|
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
@ -195,9 +198,11 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
|
|||||||
FT_Vector delta;
|
FT_Vector delta;
|
||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
int has_kerning, st;
|
int has_kerning, st;
|
||||||
|
GlyphBLF **glyph_ascii_table;
|
||||||
|
|
||||||
if (!font->glyph_cache)
|
if (!font->glyph_cache)
|
||||||
return;
|
return;
|
||||||
|
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||||
|
|
||||||
pen_x= 0;
|
pen_x= 0;
|
||||||
pen_y= 0;
|
pen_y= 0;
|
||||||
@ -207,7 +212,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
|
|||||||
blf_font_ensure_ascii_table(font);
|
blf_font_ensure_ascii_table(font);
|
||||||
|
|
||||||
while ((c= *(str++)) && len--) {
|
while ((c= *(str++)) && len--) {
|
||||||
g= font->glyph_ascii_table[c];
|
g= font->glyph_cache->glyph_ascii_table[c];
|
||||||
|
|
||||||
/* if we don't found a glyph, skip it. */
|
/* if we don't found a glyph, skip it. */
|
||||||
if (!g)
|
if (!g)
|
||||||
@ -245,9 +250,11 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
|||||||
int pen_x, y, x;
|
int pen_x, y, x;
|
||||||
int has_kerning, st, chx, chy;
|
int has_kerning, st, chx, chy;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
GlyphBLF **glyph_ascii_table;
|
||||||
|
|
||||||
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
|
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
|
||||||
return;
|
return;
|
||||||
|
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||||
|
|
||||||
i= 0;
|
i= 0;
|
||||||
pen_x= (int)font->pos[0];
|
pen_x= (int)font->pos[0];
|
||||||
@ -264,7 +271,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
|
|||||||
while (str[i]) {
|
while (str[i]) {
|
||||||
int pen_y;
|
int pen_y;
|
||||||
|
|
||||||
BLF_UTF8_NEXT_FAST(font, g, str, i, c);
|
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
||||||
|
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
@ -390,9 +397,11 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
|
|||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
int has_kerning, st;
|
int has_kerning, st;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
GlyphBLF **glyph_ascii_table;
|
||||||
|
|
||||||
if (!font->glyph_cache)
|
if (!font->glyph_cache)
|
||||||
return;
|
return;
|
||||||
|
glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
|
||||||
|
|
||||||
box->xmin= 32000.0f;
|
box->xmin= 32000.0f;
|
||||||
box->xmax= -32000.0f;
|
box->xmax= -32000.0f;
|
||||||
@ -409,7 +418,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
|
|||||||
|
|
||||||
while (str[i]) {
|
while (str[i]) {
|
||||||
|
|
||||||
BLF_UTF8_NEXT_FAST(font, g, str, i, c);
|
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
||||||
|
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
break;
|
break;
|
||||||
@ -589,8 +598,6 @@ static void blf_font_fill(FontBLF *font)
|
|||||||
font->b_col[2]= 0;
|
font->b_col[2]= 0;
|
||||||
font->b_col[3]= 0;
|
font->b_col[3]= 0;
|
||||||
font->ft_lib= ft_lib;
|
font->ft_lib= ft_lib;
|
||||||
|
|
||||||
memset(font->glyph_ascii_table, 0, sizeof(font->glyph_ascii_table));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FontBLF *blf_font_new(const char *name, const char *filename)
|
FontBLF *blf_font_new(const char *name, const char *filename)
|
||||||
|
@ -74,7 +74,6 @@ GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
|
|||||||
GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
|
GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
|
||||||
{
|
{
|
||||||
GlyphCacheBLF *gc;
|
GlyphCacheBLF *gc;
|
||||||
int i;
|
|
||||||
|
|
||||||
gc= (GlyphCacheBLF *)MEM_mallocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
|
gc= (GlyphCacheBLF *)MEM_mallocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
|
||||||
gc->next= NULL;
|
gc->next= NULL;
|
||||||
@ -82,10 +81,8 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
|
|||||||
gc->size= font->size;
|
gc->size= font->size;
|
||||||
gc->dpi= font->dpi;
|
gc->dpi= font->dpi;
|
||||||
|
|
||||||
for (i= 0; i < 257; i++) {
|
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
|
||||||
gc->bucket[i].first= NULL;
|
memset(gc->bucket, 0, sizeof(gc->bucket));
|
||||||
gc->bucket[i].last= NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gc->textures= (GLuint *)malloc(sizeof(GLuint)*256);
|
gc->textures= (GLuint *)malloc(sizeof(GLuint)*256);
|
||||||
gc->ntex= 256;
|
gc->ntex= 256;
|
||||||
@ -136,7 +133,9 @@ void blf_glyph_cache_clear(FontBLF *font)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(font->glyph_ascii_table, 0, sizeof(font->glyph_ascii_table));
|
if(font->glyph_cache) {
|
||||||
|
memset(font->glyph_cache->glyph_ascii_table, 0, sizeof(font->glyph_cache->glyph_ascii_table));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void blf_glyph_cache_free(GlyphCacheBLF *gc)
|
void blf_glyph_cache_free(GlyphCacheBLF *gc)
|
||||||
|
@ -46,6 +46,9 @@ typedef struct GlyphCacheBLF {
|
|||||||
/* and the glyphs. */
|
/* and the glyphs. */
|
||||||
ListBase bucket[257];
|
ListBase bucket[257];
|
||||||
|
|
||||||
|
/* fast ascii lookup */
|
||||||
|
struct GlyphBLF *glyph_ascii_table[256];
|
||||||
|
|
||||||
/* texture array, to draw the glyphs. */
|
/* texture array, to draw the glyphs. */
|
||||||
GLuint *textures;
|
GLuint *textures;
|
||||||
|
|
||||||
@ -185,9 +188,6 @@ typedef struct FontBLF {
|
|||||||
/* current glyph cache, size and dpi. */
|
/* current glyph cache, size and dpi. */
|
||||||
GlyphCacheBLF *glyph_cache;
|
GlyphCacheBLF *glyph_cache;
|
||||||
|
|
||||||
/* fast ascii lookip */
|
|
||||||
GlyphBLF *glyph_ascii_table[256];
|
|
||||||
|
|
||||||
/* freetype2 lib handle. */
|
/* freetype2 lib handle. */
|
||||||
FT_Library ft_lib;
|
FT_Library ft_lib;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void end_render_materials(struct Main *);
|
|||||||
|
|
||||||
int material_in_material(struct Material *parmat, struct Material *mat);
|
int material_in_material(struct Material *parmat, struct Material *mat);
|
||||||
|
|
||||||
void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col);
|
void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3]);
|
||||||
|
|
||||||
/* copy/paste */
|
/* copy/paste */
|
||||||
void clear_matcopybuf(void);
|
void clear_matcopybuf(void);
|
||||||
|
@ -1122,7 +1122,7 @@ int object_remove_material_slot(Object *ob)
|
|||||||
|
|
||||||
/* r g b = current value, col = new value, fac==0 is no change */
|
/* r g b = current value, col = new value, fac==0 is no change */
|
||||||
/* if g==NULL, it only does r channel */
|
/* if g==NULL, it only does r channel */
|
||||||
void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
|
void ramp_blend(int type, float *r, float *g, float *b, float fac, const float col[3])
|
||||||
{
|
{
|
||||||
float tmp, facm= 1.0f-fac;
|
float tmp, facm= 1.0f-fac;
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "Recast.h"
|
#include "Recast.h"
|
||||||
|
|
||||||
extern "C"{
|
extern "C"{
|
||||||
|
@ -83,7 +83,7 @@ void mul_serie_m4(float R[4][4],
|
|||||||
float M5[4][4], float M6[4][4], float M7[4][4], float M8[4][4]);
|
float M5[4][4], float M6[4][4], float M7[4][4], float M8[4][4]);
|
||||||
|
|
||||||
void mul_m4_v3(float M[4][4], float r[3]);
|
void mul_m4_v3(float M[4][4], float r[3]);
|
||||||
void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
|
void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]);
|
||||||
void mul_mat3_m4_v3(float M[4][4], float r[3]);
|
void mul_mat3_m4_v3(float M[4][4], float r[3]);
|
||||||
void mul_m4_v4(float M[4][4], float r[4]);
|
void mul_m4_v4(float M[4][4], float r[4]);
|
||||||
void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
|
void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
|
||||||
|
@ -306,7 +306,7 @@ void mul_serie_m4(float answ[][4], float m1[][4],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mul_m4_v3(float mat[][4], float *vec)
|
void mul_m4_v3(float mat[][4], float vec[3])
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ void mul_m4_v3(float mat[][4], float *vec)
|
|||||||
vec[2]=x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
|
vec[2]=x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void mul_v3_m4v3(float *in, float mat[][4], float *vec)
|
void mul_v3_m4v3(float in[3], float mat[][4], const float vec[3])
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ void mul_v3_m4v3(float *in, float mat[][4], float *vec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* same as mul_m4_v3() but doesnt apply translation component */
|
/* same as mul_m4_v3() but doesnt apply translation component */
|
||||||
void mul_mat3_m4_v3(float mat[][4], float *vec)
|
void mul_mat3_m4_v3(float mat[][4], float vec[3])
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ void mul_m3_v3(float M[3][3], float r[3])
|
|||||||
copy_v3_v3(r, tmp);
|
copy_v3_v3(r, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mul_transposed_m3_v3(float mat[][3], float *vec)
|
void mul_transposed_m3_v3(float mat[][3], float vec[3])
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ void mul_mat3_m4_fl(float m[4][4], float f)
|
|||||||
m[i][j] *= f;
|
m[i][j] *= f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mul_m3_v3_double(float mat[][3], double *vec)
|
void mul_m3_v3_double(float mat[][3], double vec[3])
|
||||||
{
|
{
|
||||||
double x,y;
|
double x,y;
|
||||||
|
|
||||||
@ -979,14 +979,14 @@ void size_to_mat4(float mat[][4], const float size[3])
|
|||||||
copy_m4_m3(mat, tmat);
|
copy_m4_m3(mat, tmat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mat3_to_size(float *size, float mat[][3])
|
void mat3_to_size(float size[3], float mat[][3])
|
||||||
{
|
{
|
||||||
size[0]= len_v3(mat[0]);
|
size[0]= len_v3(mat[0]);
|
||||||
size[1]= len_v3(mat[1]);
|
size[1]= len_v3(mat[1]);
|
||||||
size[2]= len_v3(mat[2]);
|
size[2]= len_v3(mat[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mat4_to_size(float *size, float mat[][4])
|
void mat4_to_size(float size[3], float mat[][4])
|
||||||
{
|
{
|
||||||
size[0]= len_v3(mat[0]);
|
size[0]= len_v3(mat[0]);
|
||||||
size[1]= len_v3(mat[1]);
|
size[1]= len_v3(mat[1]);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include "DNA_mesh_types.h"
|
#include "DNA_mesh_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
|
#include "DNA_world_types.h"
|
||||||
|
|
||||||
#include "BKE_customdata.h"
|
#include "BKE_customdata.h"
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
|
|||||||
void EffectsExporter::exportEffects(Scene *sce)
|
void EffectsExporter::exportEffects(Scene *sce)
|
||||||
{
|
{
|
||||||
if(hasEffects(sce)) {
|
if(hasEffects(sce)) {
|
||||||
|
this->scene = sce;
|
||||||
openLibrary();
|
openLibrary();
|
||||||
MaterialFunctor mf;
|
MaterialFunctor mf;
|
||||||
mf.forEachMaterialInScene<EffectsExporter>(sce, *this, this->export_settings->selected);
|
mf.forEachMaterialInScene<EffectsExporter>(sce, *this, this->export_settings->selected);
|
||||||
@ -175,7 +177,12 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
|
|||||||
ep.setDiffuse(cot, false , "diffuse");
|
ep.setDiffuse(cot, false , "diffuse");
|
||||||
|
|
||||||
// ambient
|
// ambient
|
||||||
cot = getcol(ma->ambr, ma->ambg, ma->ambb, 1.0f);
|
/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
|
||||||
|
if(this->scene->world)
|
||||||
|
cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
|
||||||
|
else
|
||||||
|
cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
|
||||||
|
|
||||||
ep.setAmbient(cot, false , "ambient");
|
ep.setAmbient(cot, false , "ambient");
|
||||||
|
|
||||||
// reflective, reflectivity
|
// reflective, reflectivity
|
||||||
|
@ -70,6 +70,8 @@ private:
|
|||||||
bool hasEffects(Scene *sce);
|
bool hasEffects(Scene *sce);
|
||||||
|
|
||||||
const ExportSettings *export_settings;
|
const ExportSettings *export_settings;
|
||||||
|
|
||||||
|
Scene *scene;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +49,8 @@ ErrorHandler::~ErrorHandler()
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
|
bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
|
||||||
{
|
{
|
||||||
|
mError = true;
|
||||||
|
|
||||||
if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER )
|
if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER )
|
||||||
{
|
{
|
||||||
COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
|
COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
|
||||||
@ -59,32 +61,29 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
|
|||||||
{
|
{
|
||||||
if ( strcmp(parserError.getElement(), "effect") == 0 )
|
if ( strcmp(parserError.getElement(), "effect") == 0 )
|
||||||
{
|
{
|
||||||
return false;
|
mError = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT)
|
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT)
|
||||||
{
|
{
|
||||||
if ( (strcmp(parserError.getElement(), "extra") == 0)
|
if ( !((strcmp(parserError.getElement(), "extra") == 0)
|
||||||
&& (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0))
|
&& (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
|
||||||
{
|
{
|
||||||
return false;
|
mError = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE)
|
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE)
|
||||||
{
|
{
|
||||||
std::cout << "Couldn't open file" << std::endl;
|
std::cout << "Couldn't open file" << std::endl;
|
||||||
mError = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
|
std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
|
||||||
mError = true;
|
|
||||||
}
|
}
|
||||||
else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL )
|
else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL )
|
||||||
{
|
{
|
||||||
COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
|
COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
|
||||||
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
|
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
|
||||||
mError = true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
|
|||||||
|
|
||||||
/* skip a variable/function name */
|
/* skip a variable/function name */
|
||||||
while(*str) {
|
while(*str) {
|
||||||
if(ELEM6(*str, ' ', '(', ')', ',', '\t', '\n'))
|
if(ELEM7(*str, ' ', '(', ')', ',', '\t', '\n', '\r'))
|
||||||
break;
|
break;
|
||||||
else {
|
else {
|
||||||
if(token && len < max-1) {
|
if(token && len < max-1) {
|
||||||
@ -111,7 +111,7 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
|
|||||||
/* skip the next special characters:
|
/* skip the next special characters:
|
||||||
* note the missing ')' */
|
* note the missing ')' */
|
||||||
while(*str) {
|
while(*str) {
|
||||||
if(ELEM5(*str, ' ', '(', ',', '\t', '\n'))
|
if(ELEM6(*str, ' ', '(', ',', '\t', '\n', '\r'))
|
||||||
str++;
|
str++;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -55,10 +55,10 @@ struct ImBuf;
|
|||||||
//void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
|
//void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
|
||||||
|
|
||||||
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
/* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
||||||
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
|
int externtex(struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
|
||||||
|
|
||||||
/* particle.c */
|
/* particle.c */
|
||||||
void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype);
|
void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype);
|
||||||
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype);
|
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype);
|
||||||
|
|
||||||
/* node_composite.c */
|
/* node_composite.c */
|
||||||
|
@ -58,10 +58,10 @@ int shadeHaloFloat(HaloRen *har,
|
|||||||
/**
|
/**
|
||||||
* Render the sky at pixel (x, y).
|
* Render the sky at pixel (x, y).
|
||||||
*/
|
*/
|
||||||
void shadeSkyPixel(float *collector, float fx, float fy, short thread);
|
void shadeSkyPixel(float collector[4], float fx, float fy, short thread);
|
||||||
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread);
|
void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const float dxyview[2], short thread);
|
||||||
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
|
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
|
||||||
void shadeSunView(float *colf, float *view);
|
void shadeSunView(float col_r[3], const float view[3]);
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,13 +59,13 @@ void threaded_makeshadowbufs(struct Render *re);
|
|||||||
* @param inp The inproduct between viewvector and ?
|
* @param inp The inproduct between viewvector and ?
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
float testshadowbuf(struct Render *re, struct ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp, float mat_bias);
|
float testshadowbuf(struct Render *re, struct ShadBuf *shb, const float rco[3], const float dxco[3], const float dyco[3], float inp, float mat_bias);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the shadow factor for lamp <lar>, between <p1>
|
* Determines the shadow factor for lamp <lar>, between <p1>
|
||||||
* and <p2>. (Which CS?)
|
* and <p2>. (Which CS?)
|
||||||
*/
|
*/
|
||||||
float shadow_halo(LampRen *lar, float *p1, float *p2);
|
float shadow_halo(LampRen *lar, const float p1[3], const float p2[3]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Irregular shadowbuffer
|
* Irregular shadowbuffer
|
||||||
|
@ -96,7 +96,7 @@ void ambient_occlusion(struct ShadeInput *shi);
|
|||||||
void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr);
|
void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr);
|
||||||
|
|
||||||
ListBase *get_lights(struct ShadeInput *shi);
|
ListBase *get_lights(struct ShadeInput *shi);
|
||||||
float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);
|
float lamp_get_visibility(struct LampRen *lar, const float co[3], float *lv, float *dist);
|
||||||
void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real);
|
void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real);
|
||||||
|
|
||||||
float fresnel_fac(float *view, float *vn, float fresnel, float fac);
|
float fresnel_fac(float *view, float *vn, float fresnel, float fac);
|
||||||
|
@ -64,11 +64,11 @@ struct ImBuf;
|
|||||||
|
|
||||||
/* texture.h */
|
/* texture.h */
|
||||||
|
|
||||||
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
|
void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
|
||||||
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread);
|
void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread);
|
||||||
void do_material_tex(struct ShadeInput *shi);
|
void do_material_tex(struct ShadeInput *shi);
|
||||||
void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
|
void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi, float col_r[3], int effect);
|
||||||
void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val);
|
void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val);
|
||||||
|
|
||||||
void init_render_textures(Render *re);
|
void init_render_textures(Render *re);
|
||||||
void end_render_textures(Render *re);
|
void end_render_textures(Render *re);
|
||||||
@ -77,8 +77,8 @@ void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
|
|||||||
|
|
||||||
/* imagetexture.h */
|
/* imagetexture.h */
|
||||||
|
|
||||||
int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, float *texvec, float *dxt, float *dyt, struct TexResult *texres);
|
int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[3], const float dyt[3], struct TexResult *texres);
|
||||||
int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, float *texvec, struct TexResult *texres);
|
int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
|
||||||
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float *result);
|
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float *result);
|
||||||
|
|
||||||
#endif /* TEXTURE_EXT_H */
|
#endif /* TEXTURE_EXT_H */
|
||||||
|
@ -35,8 +35,8 @@ struct Isect;
|
|||||||
struct ShadeInput;
|
struct ShadeInput;
|
||||||
struct ShadeResult;
|
struct ShadeResult;
|
||||||
|
|
||||||
float vol_get_density(struct ShadeInput *shi, float *co);
|
float vol_get_density(struct ShadeInput *shi, const float co[3]);
|
||||||
void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co_);
|
void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3], const float view[3]);
|
||||||
|
|
||||||
void shade_volume_outside(ShadeInput *shi, ShadeResult *shr);
|
void shade_volume_outside(ShadeInput *shi, ShadeResult *shr);
|
||||||
void shade_volume_inside(ShadeInput *shi, ShadeResult *shr);
|
void shade_volume_inside(ShadeInput *shi, ShadeResult *shr);
|
||||||
|
@ -111,7 +111,7 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texres)
|
int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResult *texres)
|
||||||
{
|
{
|
||||||
float fx, fy, val1, val2, val3;
|
float fx, fy, val1, val2, val3;
|
||||||
int x, y, retval;
|
int x, y, retval;
|
||||||
@ -1019,7 +1019,7 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *dxt, float *dyt, TexResult *texres)
|
static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[3], float dyt[3], TexResult *texres)
|
||||||
{
|
{
|
||||||
TexResult texr;
|
TexResult texr;
|
||||||
float fx, fy, minx, maxx, miny, maxy;
|
float fx, fy, minx, maxx, miny, maxy;
|
||||||
@ -1409,7 +1409,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, float *DYT, TexResult *texres)
|
int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[3], const float DYT[3], TexResult *texres)
|
||||||
{
|
{
|
||||||
TexResult texr;
|
TexResult texr;
|
||||||
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3];
|
float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3];
|
||||||
@ -1418,8 +1418,8 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
|
|||||||
|
|
||||||
// TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
|
// TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
|
||||||
// make a local copy here so that original vecs remain untouched
|
// make a local copy here so that original vecs remain untouched
|
||||||
VECCOPY(dxt, DXT);
|
copy_v3_v3(dxt, DXT);
|
||||||
VECCOPY(dyt, DYT);
|
copy_v3_v3(dyt, DYT);
|
||||||
|
|
||||||
// anisotropic filtering
|
// anisotropic filtering
|
||||||
if (tex->texfilter != TXF_BOX)
|
if (tex->texfilter != TXF_BOX)
|
||||||
|
@ -76,7 +76,7 @@ extern struct Render R;
|
|||||||
|
|
||||||
extern float hashvectf[];
|
extern float hashvectf[];
|
||||||
|
|
||||||
static void render_lighting_halo(HaloRen *har, float *colf)
|
static void render_lighting_halo(HaloRen *har, float col_r[3])
|
||||||
{
|
{
|
||||||
GroupObject *go;
|
GroupObject *go;
|
||||||
LampRen *lar;
|
LampRen *lar;
|
||||||
@ -246,9 +246,9 @@ static void render_lighting_halo(HaloRen *har, float *colf)
|
|||||||
if(ig<0.0f) ig= 0.0f;
|
if(ig<0.0f) ig= 0.0f;
|
||||||
if(ib<0.0f) ib= 0.0f;
|
if(ib<0.0f) ib= 0.0f;
|
||||||
|
|
||||||
colf[0]*= ir;
|
col_r[0]*= ir;
|
||||||
colf[1]*= ig;
|
col_r[1]*= ig;
|
||||||
colf[2]*= ib;
|
col_r[2]*= ib;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,8 +502,8 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Only view vector is important here. Result goes to colf[3] */
|
/* Only view vector is important here. Result goes to col_r[3] */
|
||||||
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread)
|
void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const float dxyview[2], short thread)
|
||||||
{
|
{
|
||||||
float lo[3], zen[3], hor[3], blend, blendm;
|
float lo[3], zen[3], hor[3], blend, blendm;
|
||||||
int skyflag;
|
int skyflag;
|
||||||
@ -528,13 +528,13 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th
|
|||||||
blend= fabs(0.5f + view[1]);
|
blend= fabs(0.5f + view[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECCOPY(hor, &R.wrld.horr);
|
copy_v3_v3(hor, &R.wrld.horr);
|
||||||
VECCOPY(zen, &R.wrld.zenr);
|
copy_v3_v3(zen, &R.wrld.zenr);
|
||||||
|
|
||||||
/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If */
|
/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If */
|
||||||
/* SKYBLEND is active, the texture and color blend are added. */
|
/* SKYBLEND is active, the texture and color blend are added. */
|
||||||
if(R.wrld.skytype & WO_SKYTEX) {
|
if(R.wrld.skytype & WO_SKYTEX) {
|
||||||
VECCOPY(lo, view);
|
copy_v3_v3(lo, view);
|
||||||
if(R.wrld.skytype & WO_SKYREAL) {
|
if(R.wrld.skytype & WO_SKYREAL) {
|
||||||
|
|
||||||
mul_m3_v3(R.imat, lo);
|
mul_m3_v3(R.imat, lo);
|
||||||
@ -550,19 +550,19 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th
|
|||||||
|
|
||||||
/* No clipping, no conversion! */
|
/* No clipping, no conversion! */
|
||||||
if(R.wrld.skytype & WO_SKYBLEND) {
|
if(R.wrld.skytype & WO_SKYBLEND) {
|
||||||
colf[0] = (blendm*hor[0] + blend*zen[0]);
|
col_r[0] = (blendm*hor[0] + blend*zen[0]);
|
||||||
colf[1] = (blendm*hor[1] + blend*zen[1]);
|
col_r[1] = (blendm*hor[1] + blend*zen[1]);
|
||||||
colf[2] = (blendm*hor[2] + blend*zen[2]);
|
col_r[2] = (blendm*hor[2] + blend*zen[2]);
|
||||||
} else {
|
} else {
|
||||||
/* Done when a texture was grabbed. */
|
/* Done when a texture was grabbed. */
|
||||||
colf[0]= hor[0];
|
col_r[0]= hor[0];
|
||||||
colf[1]= hor[1];
|
col_r[1]= hor[1];
|
||||||
colf[2]= hor[2];
|
col_r[2]= hor[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shade sky according to sun lamps, all parameters are like shadeSkyView except sunsky*/
|
/* shade sky according to sun lamps, all parameters are like shadeSkyView except sunsky*/
|
||||||
void shadeSunView(float *colf, float *view)
|
void shadeSunView(float col_r[3], const float view[3])
|
||||||
{
|
{
|
||||||
GroupObject *go;
|
GroupObject *go;
|
||||||
LampRen *lar;
|
LampRen *lar;
|
||||||
@ -577,8 +577,7 @@ void shadeSunView(float *colf, float *view)
|
|||||||
|
|
||||||
if(do_init) {
|
if(do_init) {
|
||||||
|
|
||||||
VECCOPY(sview, view);
|
normalize_v3_v3(sview, view);
|
||||||
normalize_v3(sview);
|
|
||||||
mul_m3_v3(R.imat, sview);
|
mul_m3_v3(R.imat, sview);
|
||||||
if (sview[2] < 0.0f)
|
if (sview[2] < 0.0f)
|
||||||
sview[2] = 0.0f;
|
sview[2] = 0.0f;
|
||||||
@ -590,7 +589,7 @@ void shadeSunView(float *colf, float *view)
|
|||||||
xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sun_collector[0], &sun_collector[1], &sun_collector[2],
|
xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sun_collector[0], &sun_collector[1], &sun_collector[2],
|
||||||
lar->sunsky->sky_colorspace);
|
lar->sunsky->sky_colorspace);
|
||||||
|
|
||||||
ramp_blend(lar->sunsky->skyblendtype, colf, colf+1, colf+2, lar->sunsky->skyblendfac, sun_collector);
|
ramp_blend(lar->sunsky->skyblendtype, col_r, col_r+1, col_r+2, lar->sunsky->skyblendfac, sun_collector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -599,7 +598,7 @@ void shadeSunView(float *colf, float *view)
|
|||||||
/*
|
/*
|
||||||
Stuff the sky color into the collector.
|
Stuff the sky color into the collector.
|
||||||
*/
|
*/
|
||||||
void shadeSkyPixel(float *collector, float fx, float fy, short thread)
|
void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
|
||||||
{
|
{
|
||||||
float view[3], dxyview[2];
|
float view[3], dxyview[2];
|
||||||
|
|
||||||
@ -649,7 +648,7 @@ void shadeSkyPixel(float *collector, float fx, float fy, short thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* aerial perspective */
|
/* aerial perspective */
|
||||||
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance)
|
void shadeAtmPixel(struct SunSky *sunsky, float collector[3], float fx, float fy, float distance)
|
||||||
{
|
{
|
||||||
float view[3];
|
float view[3];
|
||||||
|
|
||||||
|
@ -1374,7 +1374,7 @@ int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres)
|
|||||||
|
|
||||||
/* in = destination, tex = texture, out = previous color */
|
/* in = destination, tex = texture, out = previous color */
|
||||||
/* fact = texture strength, facg = button strength value */
|
/* fact = texture strength, facg = button strength value */
|
||||||
void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype)
|
void texture_rgb_blend(float in[3], const float tex[3], const float out[3], float fact, float facg, int blendtype)
|
||||||
{
|
{
|
||||||
float facm, col;
|
float facm, col;
|
||||||
|
|
||||||
@ -2658,7 +2658,7 @@ void do_material_tex(ShadeInput *shi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val)
|
void do_volume_tex(ShadeInput *shi, const float xyz[3], int mapto_flag, float col[3], float *val)
|
||||||
{
|
{
|
||||||
MTex *mtex;
|
MTex *mtex;
|
||||||
Tex *tex;
|
Tex *tex;
|
||||||
@ -2838,7 +2838,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||||
{
|
{
|
||||||
MTex *mtex;
|
MTex *mtex;
|
||||||
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
|
||||||
@ -2945,23 +2945,23 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
|||||||
if(mtex->blendtype==MTEX_SUB) fact= -fact;
|
if(mtex->blendtype==MTEX_SUB) fact= -fact;
|
||||||
|
|
||||||
if(mtex->blendtype==MTEX_BLEND) {
|
if(mtex->blendtype==MTEX_BLEND) {
|
||||||
colf[0]= (fact*texres.tr + facm*har->r);
|
col_r[0]= (fact*texres.tr + facm*har->r);
|
||||||
colf[1]= (fact*texres.tg + facm*har->g);
|
col_r[1]= (fact*texres.tg + facm*har->g);
|
||||||
colf[2]= (fact*texres.tb + facm*har->b);
|
col_r[2]= (fact*texres.tb + facm*har->b);
|
||||||
}
|
}
|
||||||
else if(mtex->blendtype==MTEX_MUL) {
|
else if(mtex->blendtype==MTEX_MUL) {
|
||||||
colf[0]= (facm+fact*texres.tr)*har->r;
|
col_r[0]= (facm+fact*texres.tr)*har->r;
|
||||||
colf[1]= (facm+fact*texres.tg)*har->g;
|
col_r[1]= (facm+fact*texres.tg)*har->g;
|
||||||
colf[2]= (facm+fact*texres.tb)*har->b;
|
col_r[2]= (facm+fact*texres.tb)*har->b;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
colf[0]= (fact*texres.tr + har->r);
|
col_r[0]= (fact*texres.tr + har->r);
|
||||||
colf[1]= (fact*texres.tg + har->g);
|
col_r[1]= (fact*texres.tg + har->g);
|
||||||
colf[2]= (fact*texres.tb + har->b);
|
col_r[2]= (fact*texres.tb + har->b);
|
||||||
|
|
||||||
CLAMP(colf[0], 0.0f, 1.0f);
|
CLAMP(col_r[0], 0.0f, 1.0f);
|
||||||
CLAMP(colf[1], 0.0f, 1.0f);
|
CLAMP(col_r[1], 0.0f, 1.0f);
|
||||||
CLAMP(colf[2], 0.0f, 1.0f);
|
CLAMP(col_r[2], 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mtex->mapto & MAP_ALPHA) {
|
if(mtex->mapto & MAP_ALPHA) {
|
||||||
@ -2970,14 +2970,14 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
|||||||
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
colf[3]*= texres.tin;
|
col_r[3]*= texres.tin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
|
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
|
||||||
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread)
|
void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float hor[3], float zen[3], float *blend, int skyflag, short thread)
|
||||||
{
|
{
|
||||||
MTex *mtex;
|
MTex *mtex;
|
||||||
Tex *tex;
|
Tex *tex;
|
||||||
@ -3172,9 +3172,9 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* colf supposed to be initialized with la->r,g,b */
|
/* col_r supposed to be initialized with la->r,g,b */
|
||||||
|
|
||||||
void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int effect)
|
void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r[3], int effect)
|
||||||
{
|
{
|
||||||
Object *ob;
|
Object *ob;
|
||||||
MTex *mtex;
|
MTex *mtex;
|
||||||
@ -3356,7 +3356,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
|
|||||||
col[1]= texres.tg*la->energy;
|
col[1]= texres.tg*la->energy;
|
||||||
col[2]= texres.tb*la->energy;
|
col[2]= texres.tb*la->energy;
|
||||||
|
|
||||||
texture_rgb_blend(colf, col, colf, texres.tin, mtex->colfac, mtex->blendtype);
|
texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3364,7 +3364,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
|
int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread)
|
||||||
{
|
{
|
||||||
Tex *tex;
|
Tex *tex;
|
||||||
TexResult texr;
|
TexResult texr;
|
||||||
|
@ -1099,7 +1099,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, float co[3])
|
static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, const float co[3])
|
||||||
{
|
{
|
||||||
float hco[4], size= 0.5f*(float)shb->size;
|
float hco[4], size= 0.5f*(float)shb->size;
|
||||||
|
|
||||||
@ -1115,7 +1115,7 @@ static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, flo
|
|||||||
|
|
||||||
/* the externally called shadow testing (reading) function */
|
/* the externally called shadow testing (reading) function */
|
||||||
/* return 1.0: no shadow at all */
|
/* return 1.0: no shadow at all */
|
||||||
float testshadowbuf(Render *re, ShadBuf *shb, float *co, float *dxco, float *dyco, float inp, float mat_bias)
|
float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxco[3], const float dyco[3], float inp, float mat_bias)
|
||||||
{
|
{
|
||||||
ShadSampleBuf *shsample;
|
ShadSampleBuf *shsample;
|
||||||
float fac, dco[3], dx[3], dy[3], shadfac=0.0f;
|
float fac, dco[3], dx[3], dy[3], shadfac=0.0f;
|
||||||
@ -1291,7 +1291,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float shadow_halo(LampRen *lar, float *p1, float *p2)
|
float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
|
||||||
{
|
{
|
||||||
/* p1 p2 already are rotated in spot-space */
|
/* p1 p2 already are rotated in spot-space */
|
||||||
ShadBuf *shb= lar->shb;
|
ShadBuf *shb= lar->shb;
|
||||||
@ -1469,7 +1469,7 @@ static void init_box(Boxf *box)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* use v1 to calculate boundbox */
|
/* use v1 to calculate boundbox */
|
||||||
static void bound_boxf(Boxf *box, float *v1)
|
static void bound_boxf(Boxf *box, const float v1[3])
|
||||||
{
|
{
|
||||||
if(v1[0] < box->xmin) box->xmin= v1[0];
|
if(v1[0] < box->xmin) box->xmin= v1[0];
|
||||||
if(v1[0] > box->xmax) box->xmax= v1[0];
|
if(v1[0] > box->xmax) box->xmax= v1[0];
|
||||||
@ -1480,7 +1480,7 @@ static void bound_boxf(Boxf *box, float *v1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* use v1 to calculate boundbox */
|
/* use v1 to calculate boundbox */
|
||||||
static void bound_rectf(rctf *box, float *v1)
|
static void bound_rectf(rctf *box, const float v1[2])
|
||||||
{
|
{
|
||||||
if(v1[0] < box->xmin) box->xmin= v1[0];
|
if(v1[0] < box->xmin) box->xmin= v1[0];
|
||||||
if(v1[0] > box->xmax) box->xmax= v1[0];
|
if(v1[0] > box->xmax) box->xmax= v1[0];
|
||||||
@ -1639,24 +1639,17 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float VecLen2f( float *v1, float *v2)
|
|
||||||
{
|
|
||||||
float x= v1[0]-v2[0];
|
|
||||||
float y= v1[1]-v2[1];
|
|
||||||
return (float)sqrt(x*x+y*y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize vars in face, for optimal point-in-face test */
|
/* initialize vars in face, for optimal point-in-face test */
|
||||||
static void bspface_init_strand(BSPFace *face)
|
static void bspface_init_strand(BSPFace *face)
|
||||||
{
|
{
|
||||||
|
|
||||||
face->radline= 0.5f*VecLen2f(face->v1, face->v2);
|
face->radline= 0.5f* len_v2v2(face->v1, face->v2);
|
||||||
|
|
||||||
mid_v3_v3v3(face->vec1, face->v1, face->v2);
|
mid_v3_v3v3(face->vec1, face->v1, face->v2);
|
||||||
if(face->v4)
|
if(face->v4)
|
||||||
mid_v3_v3v3(face->vec2, face->v3, face->v4);
|
mid_v3_v3v3(face->vec2, face->v3, face->v4);
|
||||||
else
|
else
|
||||||
VECCOPY(face->vec2, face->v3);
|
copy_v3_v3(face->vec2, face->v3);
|
||||||
|
|
||||||
face->rc[0]= face->vec2[0]-face->vec1[0];
|
face->rc[0]= face->vec2[0]-face->vec1[0];
|
||||||
face->rc[1]= face->vec2[1]-face->vec1[1];
|
face->rc[1]= face->vec2[1]-face->vec1[1];
|
||||||
@ -1671,7 +1664,7 @@ static void bspface_init_strand(BSPFace *face)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* brought back to a simple 2d case */
|
/* brought back to a simple 2d case */
|
||||||
static int point_behind_strand(float *p, BSPFace *face)
|
static int point_behind_strand(const float p[3], BSPFace *face)
|
||||||
{
|
{
|
||||||
/* v1 - v2 is radius, v1 - v3 length */
|
/* v1 - v2 is radius, v1 - v3 length */
|
||||||
float dist, rc[2], pt[2];
|
float dist, rc[2], pt[2];
|
||||||
@ -1712,7 +1705,7 @@ static int point_behind_strand(float *p, BSPFace *face)
|
|||||||
|
|
||||||
|
|
||||||
/* return 1 if inside. code derived from src/parametrizer.c */
|
/* return 1 if inside. code derived from src/parametrizer.c */
|
||||||
static int point_behind_tria2d(float *p, float *v1, float *v2, float *v3)
|
static int point_behind_tria2d(const float p[3], const float v1[3], const float v2[3], const float v3[3])
|
||||||
{
|
{
|
||||||
float a[2], c[2], h[2], div;
|
float a[2], c[2], h[2], div;
|
||||||
float u, v;
|
float u, v;
|
||||||
@ -1751,7 +1744,7 @@ static int point_behind_tria2d(float *p, float *v1, float *v2, float *v3)
|
|||||||
/* tested these calls, but it gives inaccuracy, 'side' cannot be found reliably using v3 */
|
/* tested these calls, but it gives inaccuracy, 'side' cannot be found reliably using v3 */
|
||||||
|
|
||||||
/* check if line v1-v2 has all rect points on other side of point v3 */
|
/* check if line v1-v2 has all rect points on other side of point v3 */
|
||||||
static int rect_outside_line(rctf *rect, float *v1, float *v2, float *v3)
|
static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
|
||||||
{
|
{
|
||||||
float a, b, c;
|
float a, b, c;
|
||||||
int side;
|
int side;
|
||||||
@ -1772,7 +1765,7 @@ static int rect_outside_line(rctf *rect, float *v1, float *v2, float *v3)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if one of the triangle edges separates all rect points on 1 side */
|
/* check if one of the triangle edges separates all rect points on 1 side */
|
||||||
static int rect_isect_tria(rctf *rect, float *v1, float *v2, float *v3)
|
static int rect_isect_tria(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
|
||||||
{
|
{
|
||||||
if(rect_outside_line(rect, v1, v2, v3))
|
if(rect_outside_line(rect, v1, v2, v3))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1935,7 +1928,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
|
|||||||
isb_bsp_face_inside((ISBBranch *)zspan->rectz, &face);
|
isb_bsp_face_inside((ISBBranch *)zspan->rectz, &face);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testclip_minmax(float *ho, float *minmax)
|
static int testclip_minmax(const float ho[4], const float minmax[4])
|
||||||
{
|
{
|
||||||
float wco= ho[3];
|
float wco= ho[3];
|
||||||
int flag= 0;
|
int flag= 0;
|
||||||
@ -2064,7 +2057,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns 1 when the viewpixel is visible in lampbuffer */
|
/* returns 1 when the viewpixel is visible in lampbuffer */
|
||||||
static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *vlr, float x, float y, float *co)
|
static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *vlr, float x, float y, float co_r[3])
|
||||||
{
|
{
|
||||||
float hoco[4], v1[3], nor[3];
|
float hoco[4], v1[3], nor[3];
|
||||||
float dface, fac, siz;
|
float dface, fac, siz;
|
||||||
@ -2123,12 +2116,12 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
siz= 0.5f*(float)shb->size;
|
siz= 0.5f*(float)shb->size;
|
||||||
co[0]= siz*(1.0f+hoco[0]/hoco[3]) -0.5f;
|
co_r[0]= siz*(1.0f+hoco[0]/hoco[3]) -0.5f;
|
||||||
co[1]= siz*(1.0f+hoco[1]/hoco[3]) -0.5f;
|
co_r[1]= siz*(1.0f+hoco[1]/hoco[3]) -0.5f;
|
||||||
co[2]= ((float)0x7FFFFFFF)*(hoco[2]/hoco[3]);
|
co_r[2]= ((float)0x7FFFFFFF)*(hoco[2]/hoco[3]);
|
||||||
|
|
||||||
/* XXXX bias, much less than normal shadbuf, or do we need a constant? */
|
/* XXXX bias, much less than normal shadbuf, or do we need a constant? */
|
||||||
co[2] -= 0.05f*shb->bias;
|
co_r[2] -= 0.05f*shb->bias;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ static void *vol_precache_part(void *data)
|
|||||||
RayObject *tree = pa->tree;
|
RayObject *tree = pa->tree;
|
||||||
ShadeInput *shi = pa->shi;
|
ShadeInput *shi = pa->shi;
|
||||||
float scatter_col[3] = {0.f, 0.f, 0.f};
|
float scatter_col[3] = {0.f, 0.f, 0.f};
|
||||||
float co[3], cco[3];
|
float co[3], cco[3], view[3];
|
||||||
int x, y, z, i;
|
int x, y, z, i;
|
||||||
int res[3];
|
int res[3];
|
||||||
|
|
||||||
@ -523,9 +523,9 @@ static void *vol_precache_part(void *data)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_v3_v3(shi->view, cco);
|
copy_v3_v3(view, cco);
|
||||||
normalize_v3(shi->view);
|
normalize_v3(view);
|
||||||
vol_get_scattering(shi, scatter_col, cco);
|
vol_get_scattering(shi, scatter_col, cco, view);
|
||||||
|
|
||||||
obi->volume_precache->data_r[i] = scatter_col[0];
|
obi->volume_precache->data_r[i] = scatter_col[0];
|
||||||
obi->volume_precache->data_g[i] = scatter_col[1];
|
obi->volume_precache->data_g[i] = scatter_col[1];
|
||||||
|
@ -70,13 +70,13 @@ extern struct Render R;
|
|||||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
|
|
||||||
/* luminance rec. 709 */
|
/* luminance rec. 709 */
|
||||||
BM_INLINE float luminance(float* col)
|
BM_INLINE float luminance(const float col[3])
|
||||||
{
|
{
|
||||||
return (0.212671f*col[0] + 0.71516f*col[1] + 0.072169f*col[2]);
|
return (0.212671f*col[0] + 0.71516f*col[1] + 0.072169f*col[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tracing */
|
/* tracing */
|
||||||
static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co)
|
static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
|
||||||
{
|
{
|
||||||
float visibility = 1.f;
|
float visibility = 1.f;
|
||||||
|
|
||||||
@ -121,11 +121,11 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, float *co)
|
|||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco, Isect *isect, int intersect_type)
|
static int vol_get_bounds(ShadeInput *shi, const float co[3], const float vec[3], float hitco[3], Isect *isect, int intersect_type)
|
||||||
{
|
{
|
||||||
|
|
||||||
VECCOPY(isect->start, co);
|
copy_v3_v3(isect->start, co);
|
||||||
VECCOPY(isect->dir, vec );
|
copy_v3_v3(isect->dir, vec);
|
||||||
isect->dist = FLT_MAX;
|
isect->dist = FLT_MAX;
|
||||||
isect->mode= RE_RAY_MIRROR;
|
isect->mode= RE_RAY_MIRROR;
|
||||||
isect->last_hit = NULL;
|
isect->last_hit = NULL;
|
||||||
@ -153,7 +153,7 @@ static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
|
static void shade_intersection(ShadeInput *shi, float col_r[4], Isect *is)
|
||||||
{
|
{
|
||||||
ShadeInput shi_new;
|
ShadeInput shi_new;
|
||||||
ShadeResult shr_new;
|
ShadeResult shr_new;
|
||||||
@ -173,7 +173,7 @@ static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
|
|||||||
shi_new.light_override= shi->light_override;
|
shi_new.light_override= shi->light_override;
|
||||||
shi_new.mat_override= shi->mat_override;
|
shi_new.mat_override= shi->mat_override;
|
||||||
|
|
||||||
VECCOPY(shi_new.camera_co, is->start);
|
copy_v3_v3(shi_new.camera_co, is->start);
|
||||||
|
|
||||||
memset(&shr_new, 0, sizeof(ShadeResult));
|
memset(&shr_new, 0, sizeof(ShadeResult));
|
||||||
|
|
||||||
@ -182,16 +182,16 @@ static void shade_intersection(ShadeInput *shi, float *col, Isect *is)
|
|||||||
shade_ray(is, &shi_new, &shr_new);
|
shade_ray(is, &shi_new, &shr_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_v3_v3(col, shr_new.combined);
|
copy_v3_v3(col_r, shr_new.combined);
|
||||||
col[3] = shr_new.alpha;
|
col_r[3] = shr_new.alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *col)
|
static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col[3])
|
||||||
{
|
{
|
||||||
Isect isect;
|
Isect isect;
|
||||||
|
|
||||||
VECCOPY(isect.start, co);
|
copy_v3_v3(isect.start, co);
|
||||||
VECCOPY(isect.dir, shi->view);
|
copy_v3_v3(isect.dir, shi->view);
|
||||||
isect.dist = FLT_MAX;
|
isect.dist = FLT_MAX;
|
||||||
|
|
||||||
isect.mode= RE_RAY_MIRROR;
|
isect.mode= RE_RAY_MIRROR;
|
||||||
@ -213,7 +213,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co
|
|||||||
|
|
||||||
|
|
||||||
/* trilinear interpolation */
|
/* trilinear interpolation */
|
||||||
static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float *scatter_col, float *co)
|
static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float scatter_col[3], const float co[3])
|
||||||
{
|
{
|
||||||
VolumePrecache *vp = shi->obi->volume_precache;
|
VolumePrecache *vp = shi->obi->volume_precache;
|
||||||
float bbmin[3], bbmax[3], dim[3];
|
float bbmin[3], bbmax[3], dim[3];
|
||||||
@ -238,7 +238,7 @@ static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float *sca
|
|||||||
|
|
||||||
/* Meta object density, brute force for now
|
/* Meta object density, brute force for now
|
||||||
* (might be good enough anyway, don't need huge number of metaobs to model volumetric objects */
|
* (might be good enough anyway, don't need huge number of metaobs to model volumetric objects */
|
||||||
static float metadensity(Object* ob, float* co)
|
static float metadensity(Object* ob, const float co[3])
|
||||||
{
|
{
|
||||||
float mat[4][4], imat[4][4], dens = 0.f;
|
float mat[4][4], imat[4][4], dens = 0.f;
|
||||||
MetaBall* mb = (MetaBall*)ob->data;
|
MetaBall* mb = (MetaBall*)ob->data;
|
||||||
@ -284,7 +284,7 @@ static float metadensity(Object* ob, float* co)
|
|||||||
return (dens < 0.f) ? 0.f : dens;
|
return (dens < 0.f) ? 0.f : dens;
|
||||||
}
|
}
|
||||||
|
|
||||||
float vol_get_density(struct ShadeInput *shi, float *co)
|
float vol_get_density(struct ShadeInput *shi, const float co[3])
|
||||||
{
|
{
|
||||||
float density = shi->mat->vol.density;
|
float density = shi->mat->vol.density;
|
||||||
float density_scale = shi->mat->vol.density_scale;
|
float density_scale = shi->mat->vol.density_scale;
|
||||||
@ -305,11 +305,11 @@ float vol_get_density(struct ShadeInput *shi, float *co)
|
|||||||
/* Color of light that gets scattered out by the volume */
|
/* Color of light that gets scattered out by the volume */
|
||||||
/* Uses same physically based scattering parameter as in transmission calculations,
|
/* Uses same physically based scattering parameter as in transmission calculations,
|
||||||
* along with artificial reflection scale/reflection color tint */
|
* along with artificial reflection scale/reflection color tint */
|
||||||
static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
|
static void vol_get_reflection_color(ShadeInput *shi, float ref_col[3], const float co[3])
|
||||||
{
|
{
|
||||||
float scatter = shi->mat->vol.scattering;
|
float scatter = shi->mat->vol.scattering;
|
||||||
float reflection= shi->mat->vol.reflection;
|
float reflection= shi->mat->vol.reflection;
|
||||||
VECCOPY(ref_col, shi->mat->vol.reflection_col);
|
copy_v3_v3(ref_col, shi->mat->vol.reflection_col);
|
||||||
|
|
||||||
if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_REFLECTION_COL))
|
if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_REFLECTION_COL))
|
||||||
do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter);
|
do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter);
|
||||||
@ -325,10 +325,10 @@ static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
|
|||||||
|
|
||||||
/* compute emission component, amount of radiance to add per segment
|
/* compute emission component, amount of radiance to add per segment
|
||||||
* can be textured with 'emit' */
|
* can be textured with 'emit' */
|
||||||
static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co)
|
static void vol_get_emission(ShadeInput *shi, float emission_col[3], const float co[3])
|
||||||
{
|
{
|
||||||
float emission = shi->mat->vol.emission;
|
float emission = shi->mat->vol.emission;
|
||||||
VECCOPY(emission_col, shi->mat->vol.emission_col);
|
copy_v3_v3(emission_col, shi->mat->vol.emission_col);
|
||||||
|
|
||||||
if (shi->mat->mapto_textured & (MAP_EMISSION+MAP_EMISSION_COL))
|
if (shi->mat->mapto_textured & (MAP_EMISSION+MAP_EMISSION_COL))
|
||||||
do_volume_tex(shi, co, MAP_EMISSION+MAP_EMISSION_COL, emission_col, &emission);
|
do_volume_tex(shi, co, MAP_EMISSION+MAP_EMISSION_COL, emission_col, &emission);
|
||||||
@ -343,7 +343,7 @@ static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co)
|
|||||||
* This can possibly use a specific scattering color,
|
* This can possibly use a specific scattering color,
|
||||||
* and absorption multiplier factor too, but these parameters are left out for simplicity.
|
* and absorption multiplier factor too, but these parameters are left out for simplicity.
|
||||||
* It's easy enough to get a good wide range of results with just these two parameters. */
|
* It's easy enough to get a good wide range of results with just these two parameters. */
|
||||||
static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
|
static void vol_get_sigma_t(ShadeInput *shi, float sigma_t[3], const float co[3])
|
||||||
{
|
{
|
||||||
/* technically absorption, but named transmission color
|
/* technically absorption, but named transmission color
|
||||||
* since it describes the effect of the coloring *after* absorption */
|
* since it describes the effect of the coloring *after* absorption */
|
||||||
@ -361,7 +361,7 @@ static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co)
|
|||||||
/* phase function - determines in which directions the light
|
/* phase function - determines in which directions the light
|
||||||
* is scattered in the volume relative to incoming direction
|
* is scattered in the volume relative to incoming direction
|
||||||
* and view direction */
|
* and view direction */
|
||||||
static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp)
|
static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3], const float wp[3])
|
||||||
{
|
{
|
||||||
const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI)
|
const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI)
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute transmittance = e^(-attenuation) */
|
/* Compute transmittance = e^(-attenuation) */
|
||||||
static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density)
|
static void vol_get_transmittance_seg(ShadeInput *shi, float tr[3], float stepsize, const float co[3], float density)
|
||||||
{
|
{
|
||||||
/* input density = density at co */
|
/* input density = density at co */
|
||||||
float tau[3] = {0.f, 0.f, 0.f};
|
float tau[3] = {0.f, 0.f, 0.f};
|
||||||
@ -428,7 +428,7 @@ static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute transmittance = e^(-attenuation) */
|
/* Compute transmittance = e^(-attenuation) */
|
||||||
static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float *endco)
|
static void vol_get_transmittance(ShadeInput *shi, float tr[3], const float co[3], const float endco[3])
|
||||||
{
|
{
|
||||||
float p[3] = {co[0], co[1], co[2]};
|
float p[3] = {co[0], co[1], co[2]};
|
||||||
float step_vec[3] = {endco[0] - co[0], endco[1] - co[1], endco[2] - co[2]};
|
float step_vec[3] = {endco[0] - co[0], endco[1] - co[1], endco[2] - co[2]};
|
||||||
@ -464,7 +464,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float *
|
|||||||
tr[2] = expf(-tau[2]);
|
tr[2] = expf(-tau[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *lacol)
|
static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const float view[3], LampRen *lar, float lacol[3])
|
||||||
{
|
{
|
||||||
float visifac, lv[3], lampdist;
|
float visifac, lv[3], lampdist;
|
||||||
float tr[3]={1.0,1.0,1.0};
|
float tr[3]={1.0,1.0,1.0};
|
||||||
@ -487,7 +487,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar,
|
|||||||
mul_v3_fl(lacol, visifac);
|
mul_v3_fl(lacol, visifac);
|
||||||
|
|
||||||
if (ELEM(lar->type, LA_SUN, LA_HEMI))
|
if (ELEM(lar->type, LA_SUN, LA_HEMI))
|
||||||
VECCOPY(lv, lar->vec);
|
copy_v3_v3(lv, lar->vec);
|
||||||
negate_v3(lv);
|
negate_v3(lv);
|
||||||
|
|
||||||
if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) {
|
if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) {
|
||||||
@ -535,7 +535,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar,
|
|||||||
if (luminance(lacol) < 0.001f) return;
|
if (luminance(lacol) < 0.001f) return;
|
||||||
|
|
||||||
normalize_v3(lv);
|
normalize_v3(lv);
|
||||||
p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, shi->view, lv);
|
p = vol_get_phasefunc(shi, shi->mat->vol.asymmetry, view, lv);
|
||||||
|
|
||||||
/* physically based scattering with non-physically based RGB gain */
|
/* physically based scattering with non-physically based RGB gain */
|
||||||
vol_get_reflection_color(shi, ref_col, co);
|
vol_get_reflection_color(shi, ref_col, co);
|
||||||
@ -546,13 +546,13 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* single scattering only for now */
|
/* single scattering only for now */
|
||||||
void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co)
|
void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3], const float view[3])
|
||||||
{
|
{
|
||||||
ListBase *lights;
|
ListBase *lights;
|
||||||
GroupObject *go;
|
GroupObject *go;
|
||||||
LampRen *lar;
|
LampRen *lar;
|
||||||
|
|
||||||
scatter_col[0] = scatter_col[1] = scatter_col[2] = 0.f;
|
zero_v3(scatter_col);
|
||||||
|
|
||||||
lights= get_lights(shi);
|
lights= get_lights(shi);
|
||||||
for(go=lights->first; go; go= go->next)
|
for(go=lights->first; go; go= go->next)
|
||||||
@ -561,7 +561,7 @@ void vol_get_scattering(ShadeInput *shi, float *scatter_col, float *co)
|
|||||||
lar= go->lampren;
|
lar= go->lampren;
|
||||||
|
|
||||||
if (lar) {
|
if (lar) {
|
||||||
vol_shade_one_lamp(shi, co, lar, lacol);
|
vol_shade_one_lamp(shi, co, view, lar, lacol);
|
||||||
add_v3_v3(scatter_col, lacol);
|
add_v3_v3(scatter_col, lacol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ outgoing radiance from behind surface * beam transmittance/attenuation
|
|||||||
* it also makes it harder to control the overall look of the volume since coloring the outscattered light results
|
* it also makes it harder to control the overall look of the volume since coloring the outscattered light results
|
||||||
* in the inverse color being transmitted through the rest of the volume.
|
* in the inverse color being transmitted through the rest of the volume.
|
||||||
*/
|
*/
|
||||||
static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float *endco)
|
static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co[3], const float endco[3])
|
||||||
{
|
{
|
||||||
float radiance[3] = {0.f, 0.f, 0.f};
|
float radiance[3] = {0.f, 0.f, 0.f};
|
||||||
float tr[3] = {1.f, 1.f, 1.f};
|
float tr[3] = {1.f, 1.f, 1.f};
|
||||||
@ -629,7 +629,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float
|
|||||||
|
|
||||||
vol_get_precached_scattering(&R, shi, scatter_col, p2);
|
vol_get_precached_scattering(&R, shi, scatter_col, p2);
|
||||||
} else
|
} else
|
||||||
vol_get_scattering(shi, scatter_col, p);
|
vol_get_scattering(shi, scatter_col, p, shi->view);
|
||||||
|
|
||||||
radiance[0] += stepd * tr[0] * (emit_col[0] + scatter_col[0]);
|
radiance[0] += stepd * tr[0] * (emit_col[0] + scatter_col[0]);
|
||||||
radiance[1] += stepd * tr[1] * (emit_col[1] + scatter_col[1]);
|
radiance[1] += stepd * tr[1] * (emit_col[1] + scatter_col[1]);
|
||||||
@ -736,7 +736,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
|
|||||||
copy_v3_v3(shr->combined, col);
|
copy_v3_v3(shr->combined, col);
|
||||||
shr->alpha = col[3];
|
shr->alpha = col[3];
|
||||||
|
|
||||||
VECCOPY(shr->diff, shr->combined);
|
copy_v3_v3(shr->diff, shr->combined);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traces a shadow through the object,
|
/* Traces a shadow through the object,
|
||||||
|
Loading…
Reference in New Issue
Block a user