style edit only - move parenthesis onto second line of function definition (in keeping with most of blenders code)
also split some long lines in own code.
This commit is contained in:
@@ -63,7 +63,8 @@ char *tcc_to_char (unsigned int tcc);
|
|||||||
|
|
||||||
/* implemetation */
|
/* implemetation */
|
||||||
|
|
||||||
unsigned int GET_FCC (FILE *fp) {
|
unsigned int GET_FCC (FILE *fp)
|
||||||
|
{
|
||||||
unsigned char tmp[4];
|
unsigned char tmp[4];
|
||||||
|
|
||||||
tmp[0] = getc(fp);
|
tmp[0] = getc(fp);
|
||||||
@@ -74,7 +75,8 @@ unsigned int GET_FCC (FILE *fp) {
|
|||||||
return FCC (tmp);
|
return FCC (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GET_TCC (FILE *fp) {
|
unsigned int GET_TCC (FILE *fp)
|
||||||
|
{
|
||||||
char tmp[5];
|
char tmp[5];
|
||||||
|
|
||||||
tmp[0] = getc(fp);
|
tmp[0] = getc(fp);
|
||||||
@@ -85,7 +87,8 @@ unsigned int GET_TCC (FILE *fp) {
|
|||||||
return FCC (tmp);
|
return FCC (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fcc_to_char (unsigned int fcc) {
|
char *fcc_to_char (unsigned int fcc)
|
||||||
|
{
|
||||||
DEBUG_FCC[0]= (fcc)&127;
|
DEBUG_FCC[0]= (fcc)&127;
|
||||||
DEBUG_FCC[1]= (fcc>>8)&127;
|
DEBUG_FCC[1]= (fcc>>8)&127;
|
||||||
DEBUG_FCC[2]= (fcc>>16)&127;
|
DEBUG_FCC[2]= (fcc>>16)&127;
|
||||||
@@ -94,7 +97,8 @@ char *fcc_to_char (unsigned int fcc) {
|
|||||||
return DEBUG_FCC;
|
return DEBUG_FCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *tcc_to_char (unsigned int tcc) {
|
char *tcc_to_char (unsigned int tcc)
|
||||||
|
{
|
||||||
DEBUG_FCC[0]= (tcc)&127;
|
DEBUG_FCC[0]= (tcc)&127;
|
||||||
DEBUG_FCC[1]= (tcc>>8)&127;
|
DEBUG_FCC[1]= (tcc>>8)&127;
|
||||||
DEBUG_FCC[2]= 0;
|
DEBUG_FCC[2]= 0;
|
||||||
@@ -103,7 +107,8 @@ char *tcc_to_char (unsigned int tcc) {
|
|||||||
return DEBUG_FCC;
|
return DEBUG_FCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) {
|
int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num)
|
||||||
|
{
|
||||||
int cur_stream;
|
int cur_stream;
|
||||||
|
|
||||||
if (movie == NULL)
|
if (movie == NULL)
|
||||||
@@ -121,7 +126,8 @@ int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) {
|
|||||||
return -AVI_ERROR_FOUND;
|
return -AVI_ERROR_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fcc_get_stream (int fcc) {
|
static int fcc_get_stream (int fcc)
|
||||||
|
{
|
||||||
char fccs[4];
|
char fccs[4];
|
||||||
|
|
||||||
fccs[0] = fcc;
|
fccs[0] = fcc;
|
||||||
@@ -132,7 +138,8 @@ static int fcc_get_stream (int fcc) {
|
|||||||
return 10*(fccs[0]-'0') + (fccs[1]-'0');
|
return 10*(fccs[0]-'0') + (fccs[1]-'0');
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fcc_is_data (int fcc) {
|
static int fcc_is_data (int fcc)
|
||||||
|
{
|
||||||
char fccs[4];
|
char fccs[4];
|
||||||
|
|
||||||
fccs[0] = fcc;
|
fccs[0] = fcc;
|
||||||
@@ -148,7 +155,8 @@ static int fcc_is_data (int fcc) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_print_error (AviError in_error) {
|
AviError AVI_print_error (AviError in_error)
|
||||||
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if ((int) in_error < 0)
|
if ((int) in_error < 0)
|
||||||
@@ -190,12 +198,14 @@ AviError AVI_print_error (AviError in_error) {
|
|||||||
return in_error;
|
return in_error;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
void AVI_set_debug (int mode) {
|
void AVI_set_debug (int mode)
|
||||||
|
{
|
||||||
AVI_DEBUG= mode;
|
AVI_DEBUG= mode;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
int AVI_is_avi (char *name) {
|
int AVI_is_avi (char *name)
|
||||||
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -216,7 +226,8 @@ int AVI_is_avi (char *name) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int AVI_is_avi (const char *name) {
|
int AVI_is_avi (const char *name)
|
||||||
|
{
|
||||||
int temp, fcca, j;
|
int temp, fcca, j;
|
||||||
AviMovie movie= {NULL};
|
AviMovie movie= {NULL};
|
||||||
AviMainHeader header;
|
AviMainHeader header;
|
||||||
@@ -407,7 +418,8 @@ int AVI_is_avi (const char *name) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_open_movie (const char *name, AviMovie *movie) {
|
AviError AVI_open_movie (const char *name, AviMovie *movie)
|
||||||
|
{
|
||||||
int temp, fcca, size, j;
|
int temp, fcca, size, j;
|
||||||
|
|
||||||
DEBUG_PRINT("opening movie\n");
|
DEBUG_PRINT("opening movie\n");
|
||||||
@@ -619,7 +631,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) {
|
|||||||
movie->entries[temp].Offset = GET_FCC (movie->fp);
|
movie->entries[temp].Offset = GET_FCC (movie->fp);
|
||||||
movie->entries[temp].Size = GET_FCC (movie->fp);
|
movie->entries[temp].Size = GET_FCC (movie->fp);
|
||||||
|
|
||||||
if (AVI_DEBUG) printf ("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, movie->entries[temp].Offset, movie->entries[temp].Size);
|
if (AVI_DEBUG) {
|
||||||
|
printf("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n",
|
||||||
|
temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags,
|
||||||
|
movie->entries[temp].Offset, movie->entries[temp].Size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some AVI's have offset entries in absolute coordinates
|
/* Some AVI's have offset entries in absolute coordinates
|
||||||
@@ -637,7 +653,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) {
|
|||||||
return AVI_ERROR_NONE;
|
return AVI_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream) {
|
void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
|
||||||
|
{
|
||||||
int cur_frame=-1, temp, i=0, rewind=1;
|
int cur_frame=-1, temp, i=0, rewind=1;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
|
|
||||||
@@ -681,7 +698,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_close (AviMovie *movie) {
|
AviError AVI_close (AviMovie *movie)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fclose (movie->fp);
|
fclose (movie->fp);
|
||||||
@@ -703,7 +721,8 @@ AviError AVI_close (AviMovie *movie) {
|
|||||||
return AVI_ERROR_NONE;
|
return AVI_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
|
AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
AviList list;
|
AviList list;
|
||||||
AviChunk chunk;
|
AviChunk chunk;
|
||||||
@@ -892,7 +911,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) {
|
|||||||
return AVI_ERROR_NONE;
|
return AVI_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) {
|
AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
|
||||||
|
{
|
||||||
AviList list;
|
AviList list;
|
||||||
AviChunk chunk;
|
AviChunk chunk;
|
||||||
AviIndexEntry *temp;
|
AviIndexEntry *temp;
|
||||||
@@ -999,7 +1019,8 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) {
|
|||||||
return AVI_ERROR_NONE;
|
return AVI_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AviError AVI_close_compress (AviMovie *movie) {
|
AviError AVI_close_compress (AviMovie *movie)
|
||||||
|
{
|
||||||
int temp, movi_size, i;
|
int temp, movi_size, i;
|
||||||
|
|
||||||
fseek (movie->fp, 0L, SEEK_END);
|
fseek (movie->fp, 0L, SEEK_END);
|
||||||
|
@@ -40,7 +40,8 @@
|
|||||||
#include "mjpeg.h"
|
#include "mjpeg.h"
|
||||||
#include "rgb32.h"
|
#include "rgb32.h"
|
||||||
|
|
||||||
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size) {
|
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size)
|
||||||
|
{
|
||||||
if (from == to)
|
if (from == to)
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
||||||
@@ -82,7 +83,8 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int avi_get_data_id (AviFormat format, int stream) {
|
int avi_get_data_id (AviFormat format, int stream)
|
||||||
|
{
|
||||||
char fcc[5];
|
char fcc[5];
|
||||||
|
|
||||||
if (avi_get_format_type (format) == FCC("vids"))
|
if (avi_get_format_type (format) == FCC("vids"))
|
||||||
@@ -95,7 +97,8 @@ int avi_get_data_id (AviFormat format, int stream) {
|
|||||||
return FCC(fcc);
|
return FCC(fcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int avi_get_format_type (AviFormat format) {
|
int avi_get_format_type (AviFormat format)
|
||||||
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case AVI_FORMAT_RGB24:
|
case AVI_FORMAT_RGB24:
|
||||||
case AVI_FORMAT_RGB32:
|
case AVI_FORMAT_RGB32:
|
||||||
@@ -109,7 +112,8 @@ int avi_get_format_type (AviFormat format) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int avi_get_format_fcc (AviFormat format) {
|
int avi_get_format_fcc (AviFormat format)
|
||||||
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case AVI_FORMAT_RGB24:
|
case AVI_FORMAT_RGB24:
|
||||||
case AVI_FORMAT_RGB32:
|
case AVI_FORMAT_RGB32:
|
||||||
@@ -125,7 +129,8 @@ int avi_get_format_fcc (AviFormat format) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int avi_get_format_compression (AviFormat format) {
|
int avi_get_format_compression (AviFormat format)
|
||||||
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case AVI_FORMAT_RGB24:
|
case AVI_FORMAT_RGB24:
|
||||||
case AVI_FORMAT_RGB32:
|
case AVI_FORMAT_RGB32:
|
||||||
|
@@ -43,7 +43,8 @@
|
|||||||
#include "avi_intern.h"
|
#include "avi_intern.h"
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN__
|
#ifdef __BIG_ENDIAN__
|
||||||
static void invert (int *num) {
|
static void invert (int *num)
|
||||||
|
{
|
||||||
int new=0,i,j;
|
int new=0,i,j;
|
||||||
|
|
||||||
for (j=0; j < 4; j++) {
|
for (j=0; j < 4; j++) {
|
||||||
@@ -55,7 +56,8 @@ static void invert (int *num) {
|
|||||||
*num = new;
|
*num = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sinvert (short int *num) {
|
static void sinvert (short int *num)
|
||||||
|
{
|
||||||
short int new=0;
|
short int new=0;
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
@@ -68,20 +70,23 @@ static void sinvert (short int *num) {
|
|||||||
*num = new;
|
*num = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Ichunk (AviChunk *chunk) {
|
static void Ichunk (AviChunk *chunk)
|
||||||
|
{
|
||||||
invert (&chunk->fcc);
|
invert (&chunk->fcc);
|
||||||
invert (&chunk->size);
|
invert (&chunk->size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BIG_ENDIAN__
|
#ifdef __BIG_ENDIAN__
|
||||||
static void Ilist (AviList *list){
|
static void Ilist (AviList *list)
|
||||||
|
{
|
||||||
invert (&list->fcc);
|
invert (&list->fcc);
|
||||||
invert (&list->size);
|
invert (&list->size);
|
||||||
invert (&list->ids);
|
invert (&list->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Imainh (AviMainHeader *mainh) {
|
static void Imainh (AviMainHeader *mainh)
|
||||||
|
{
|
||||||
invert (&mainh->fcc);
|
invert (&mainh->fcc);
|
||||||
invert (&mainh->size);
|
invert (&mainh->size);
|
||||||
invert (&mainh->MicroSecPerFrame);
|
invert (&mainh->MicroSecPerFrame);
|
||||||
@@ -100,7 +105,8 @@ static void Imainh (AviMainHeader *mainh) {
|
|||||||
invert (&mainh->Reserved[3]);
|
invert (&mainh->Reserved[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Istreamh (AviStreamHeader *streamh) {
|
static void Istreamh (AviStreamHeader *streamh)
|
||||||
|
{
|
||||||
invert (&streamh->fcc);
|
invert (&streamh->fcc);
|
||||||
invert (&streamh->size);
|
invert (&streamh->size);
|
||||||
invert (&streamh->Type);
|
invert (&streamh->Type);
|
||||||
@@ -122,7 +128,8 @@ static void Istreamh (AviStreamHeader *streamh) {
|
|||||||
sinvert (&streamh->bottom);
|
sinvert (&streamh->bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Ibitmaph (AviBitmapInfoHeader *bitmaph) {
|
static void Ibitmaph (AviBitmapInfoHeader *bitmaph)
|
||||||
|
{
|
||||||
invert (&bitmaph->fcc);
|
invert (&bitmaph->fcc);
|
||||||
invert (&bitmaph->size);
|
invert (&bitmaph->size);
|
||||||
invert (&bitmaph->Size);
|
invert (&bitmaph->Size);
|
||||||
@@ -138,7 +145,8 @@ static void Ibitmaph (AviBitmapInfoHeader *bitmaph) {
|
|||||||
invert (&bitmaph->ClrImportant);
|
invert (&bitmaph->ClrImportant);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Imjpegu (AviMJPEGUnknown *mjpgu) {
|
static void Imjpegu (AviMJPEGUnknown *mjpgu)
|
||||||
|
{
|
||||||
invert (&mjpgu->a);
|
invert (&mjpgu->a);
|
||||||
invert (&mjpgu->b);
|
invert (&mjpgu->b);
|
||||||
invert (&mjpgu->c);
|
invert (&mjpgu->c);
|
||||||
@@ -148,7 +156,8 @@ static void Imjpegu (AviMJPEGUnknown *mjpgu) {
|
|||||||
invert (&mjpgu->g);
|
invert (&mjpgu->g);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Iindexe (AviIndexEntry *indexe) {
|
static void Iindexe (AviIndexEntry *indexe)
|
||||||
|
{
|
||||||
invert (&indexe->ChunkId);
|
invert (&indexe->ChunkId);
|
||||||
invert (&indexe->Flags);
|
invert (&indexe->Flags);
|
||||||
invert (&indexe->Offset);
|
invert (&indexe->Offset);
|
||||||
@@ -156,7 +165,8 @@ static void Iindexe (AviIndexEntry *indexe) {
|
|||||||
}
|
}
|
||||||
#endif /* __BIG_ENDIAN__ */
|
#endif /* __BIG_ENDIAN__ */
|
||||||
|
|
||||||
void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type) {
|
void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
|
||||||
|
{
|
||||||
#ifdef __BIG_ENDIAN__
|
#ifdef __BIG_ENDIAN__
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
@@ -50,7 +50,8 @@ static void jpegmemsrcmgr_build (j_decompress_ptr dinfo, unsigned char *buffer,
|
|||||||
|
|
||||||
static int numbytes;
|
static int numbytes;
|
||||||
|
|
||||||
static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) {
|
static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
||||||
|
{
|
||||||
if (*htblptr == NULL)
|
if (*htblptr == NULL)
|
||||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) dinfo);
|
*htblptr = jpeg_alloc_huff_table((j_common_ptr) dinfo);
|
||||||
|
|
||||||
@@ -64,7 +65,8 @@ static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const U
|
|||||||
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
|
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
|
||||||
/* IMPORTANT: these are only valid for 8-bit data precision! */
|
/* IMPORTANT: these are only valid for 8-bit data precision! */
|
||||||
|
|
||||||
static void std_huff_tables (j_decompress_ptr dinfo) {
|
static void std_huff_tables (j_decompress_ptr dinfo)
|
||||||
|
{
|
||||||
static const UINT8 bits_dc_luminance[17] =
|
static const UINT8 bits_dc_luminance[17] =
|
||||||
{ /* 0-base */
|
{ /* 0-base */
|
||||||
0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
|
0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
@@ -142,7 +144,8 @@ static void std_huff_tables (j_decompress_ptr dinfo) {
|
|||||||
bits_ac_chrominance, val_ac_chrominance);
|
bits_ac_chrominance, val_ac_chrominance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize) {
|
static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize)
|
||||||
|
{
|
||||||
int rowstride;
|
int rowstride;
|
||||||
unsigned int y;
|
unsigned int y;
|
||||||
struct jpeg_decompress_struct dinfo;
|
struct jpeg_decompress_struct dinfo;
|
||||||
@@ -194,7 +197,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize) {
|
static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize)
|
||||||
|
{
|
||||||
int i, rowstride;
|
int i, rowstride;
|
||||||
unsigned int y;
|
unsigned int y;
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
@@ -255,7 +259,8 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
|
|||||||
jpeg_destroy_compress(&cinfo);
|
jpeg_destroy_compress(&cinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interlace(unsigned char *to, unsigned char *from, int width, int height) {
|
static void interlace(unsigned char *to, unsigned char *from, int width, int height)
|
||||||
|
{
|
||||||
int i, rowstride= width*3;
|
int i, rowstride= width*3;
|
||||||
|
|
||||||
for (i=0; i<height; i++) {
|
for (i=0; i<height; i++) {
|
||||||
@@ -266,7 +271,8 @@ static void interlace(unsigned char *to, unsigned char *from, int width, int hei
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) {
|
static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height)
|
||||||
|
{
|
||||||
int i, rowstride= width*3;
|
int i, rowstride= width*3;
|
||||||
|
|
||||||
for (i=0; i<height; i++) {
|
for (i=0; i<height; i++) {
|
||||||
@@ -277,7 +283,8 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize) {
|
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize)
|
||||||
|
{
|
||||||
/* JPEG's are always multiples of 16, extra is cropped out AVI's */
|
/* JPEG's are always multiples of 16, extra is cropped out AVI's */
|
||||||
if ((width&0xF) || (height&0xF)) {
|
if ((width&0xF) || (height&0xF)) {
|
||||||
int i, rrowstride, jrowstride;
|
int i, rrowstride, jrowstride;
|
||||||
@@ -299,7 +306,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize) {
|
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize)
|
||||||
|
{
|
||||||
/* JPEG's are always multiples of 16, extra is ignored in AVI's */
|
/* JPEG's are always multiples of 16, extra is ignored in AVI's */
|
||||||
if ((width&0xF) || (height&0xF)) {
|
if ((width&0xF) || (height&0xF)) {
|
||||||
int i, rrowstride, jrowstride;
|
int i, rrowstride, jrowstride;
|
||||||
@@ -326,7 +334,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
|
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||||
|
{
|
||||||
int deint;
|
int deint;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
@@ -349,7 +358,8 @@ void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buff
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
|
void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||||
|
{
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
int bufsize= *size;
|
int bufsize= *size;
|
||||||
|
|
||||||
@@ -380,22 +390,26 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
|
|||||||
|
|
||||||
/* Compression from memory */
|
/* Compression from memory */
|
||||||
|
|
||||||
static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) {
|
static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo)
|
||||||
|
{
|
||||||
(void)cinfo; /* unused */
|
(void)cinfo; /* unused */
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) {
|
static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo)
|
||||||
|
{
|
||||||
(void)cinfo; /* unused */
|
(void)cinfo; /* unused */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) {
|
static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo)
|
||||||
|
{
|
||||||
numbytes-= cinfo->dest->free_in_buffer;
|
numbytes-= cinfo->dest->free_in_buffer;
|
||||||
|
|
||||||
MEM_freeN(cinfo->dest);
|
MEM_freeN(cinfo->dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize) {
|
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize)
|
||||||
|
{
|
||||||
cinfo->dest= MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build");
|
cinfo->dest= MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build");
|
||||||
|
|
||||||
cinfo->dest->init_destination= jpegmemdestmgr_init_destination;
|
cinfo->dest->init_destination= jpegmemdestmgr_init_destination;
|
||||||
@@ -410,11 +424,13 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in
|
|||||||
|
|
||||||
/* Decompression from memory */
|
/* Decompression from memory */
|
||||||
|
|
||||||
static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) {
|
static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo)
|
||||||
|
{
|
||||||
(void)dinfo;
|
(void)dinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) {
|
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo)
|
||||||
|
{
|
||||||
unsigned char *buf= (unsigned char*) dinfo->src->next_input_byte-2;
|
unsigned char *buf= (unsigned char*) dinfo->src->next_input_byte-2;
|
||||||
|
|
||||||
/* if we get called, must have run out of data */
|
/* if we get called, must have run out of data */
|
||||||
@@ -429,7 +445,8 @@ static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) {
|
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
|
||||||
|
{
|
||||||
if (dinfo->src->bytes_in_buffer<skipcnt)
|
if (dinfo->src->bytes_in_buffer<skipcnt)
|
||||||
skipcnt= dinfo->src->bytes_in_buffer;
|
skipcnt= dinfo->src->bytes_in_buffer;
|
||||||
|
|
||||||
@@ -437,13 +454,15 @@ static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
|
|||||||
dinfo->src->bytes_in_buffer-= skipcnt;
|
dinfo->src->bytes_in_buffer-= skipcnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) {
|
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo)
|
||||||
|
{
|
||||||
numbytes-= dinfo->src->bytes_in_buffer;
|
numbytes-= dinfo->src->bytes_in_buffer;
|
||||||
|
|
||||||
MEM_freeN(dinfo->src);
|
MEM_freeN(dinfo->src);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize) {
|
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize)
|
||||||
|
{
|
||||||
dinfo->src= MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build");
|
dinfo->src= MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build");
|
||||||
|
|
||||||
dinfo->src->init_source= jpegmemsrcmgr_init_source;
|
dinfo->src->init_source= jpegmemsrcmgr_init_source;
|
||||||
|
@@ -43,7 +43,8 @@
|
|||||||
|
|
||||||
/* avi_set_compress_options gets its own file... now don't WE feel important? */
|
/* avi_set_compress_options gets its own file... now don't WE feel important? */
|
||||||
|
|
||||||
AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) {
|
AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
int useconds;
|
int useconds;
|
||||||
|
|
||||||
|
@@ -40,7 +40,8 @@
|
|||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
#include "rgb32.h"
|
#include "rgb32.h"
|
||||||
|
|
||||||
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
|
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||||
|
{
|
||||||
int y, x, rowstridea, rowstrideb;
|
int y, x, rowstridea, rowstrideb;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
@@ -65,7 +66,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) {
|
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned char *to, *from;
|
unsigned char *to, *from;
|
||||||
|
@@ -1514,7 +1514,8 @@ BoidState *boid_new_state(BoidSettings *boids)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state) {
|
BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state)
|
||||||
|
{
|
||||||
BoidState *staten = MEM_dupallocN(state);
|
BoidState *staten = MEM_dupallocN(state);
|
||||||
|
|
||||||
BLI_duplicatelist(&staten->rules, &state->rules);
|
BLI_duplicatelist(&staten->rules, &state->rules);
|
||||||
|
@@ -1995,7 +1995,8 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l
|
|||||||
CustomData_add_layer(ldata, CD_MLOOPCOL, CD_CALLOC, &(fdata->layers[i].name), 0);
|
CustomData_add_layer(ldata, CD_MLOOPCOL, CD_CALLOC, &(fdata->layers[i].name), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total){
|
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < pdata->totlayer; i++){
|
for(i=0; i < pdata->totlayer; i++){
|
||||||
if(pdata->layers[i].type == CD_MTEXPOLY)
|
if(pdata->layers[i].type == CD_MTEXPOLY)
|
||||||
@@ -2008,7 +2009,8 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
|
void CustomData_bmesh_init_pool(CustomData *data, int allocsize)
|
||||||
|
{
|
||||||
if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE);
|
if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1343,7 +1343,8 @@ typedef struct Ocean {
|
|||||||
} Ocean;
|
} Ocean;
|
||||||
|
|
||||||
|
|
||||||
float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage)) {
|
float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage))
|
||||||
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,8 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
|
|||||||
static char *documentation = NULL;
|
static char *documentation = NULL;
|
||||||
//static int doc_lines = 0;
|
//static int doc_lines = 0;
|
||||||
|
|
||||||
static int txttl_cmp(const char *first, const char *second, int len) {
|
static int txttl_cmp(const char *first, const char *second, int len)
|
||||||
|
{
|
||||||
int cmp, i;
|
int cmp, i;
|
||||||
for (cmp=0, i=0; i<len; i++) {
|
for (cmp=0, i=0; i<len; i++) {
|
||||||
if ( (cmp= toupper(first[i])-toupper(second[i])) ) {
|
if ( (cmp= toupper(first[i])-toupper(second[i])) ) {
|
||||||
@@ -57,7 +58,8 @@ static int txttl_cmp(const char *first, const char *second, int len) {
|
|||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void txttl_free_suggest(void) {
|
static void txttl_free_suggest(void)
|
||||||
|
{
|
||||||
SuggItem *item, *prev;
|
SuggItem *item, *prev;
|
||||||
for (item = suggestions.last; item; item=prev) {
|
for (item = suggestions.last; item; item=prev) {
|
||||||
prev = item->prev;
|
prev = item->prev;
|
||||||
@@ -69,7 +71,8 @@ static void txttl_free_suggest(void) {
|
|||||||
suggestions.top = 0;
|
suggestions.top = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void txttl_free_docs(void) {
|
static void txttl_free_docs(void)
|
||||||
|
{
|
||||||
if (documentation) {
|
if (documentation) {
|
||||||
MEM_freeN(documentation);
|
MEM_freeN(documentation);
|
||||||
documentation = NULL;
|
documentation = NULL;
|
||||||
@@ -80,23 +83,27 @@ static void txttl_free_docs(void) {
|
|||||||
/* General tool functions */
|
/* General tool functions */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
void free_texttools(void) {
|
void free_texttools(void)
|
||||||
|
{
|
||||||
txttl_free_suggest();
|
txttl_free_suggest();
|
||||||
txttl_free_docs();
|
txttl_free_docs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_text_set_active(Text *text) {
|
void texttool_text_set_active(Text *text)
|
||||||
|
{
|
||||||
if (activeToolText == text) return;
|
if (activeToolText == text) return;
|
||||||
texttool_text_clear();
|
texttool_text_clear();
|
||||||
activeToolText = text;
|
activeToolText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_text_clear(void) {
|
void texttool_text_clear(void)
|
||||||
|
{
|
||||||
free_texttools();
|
free_texttools();
|
||||||
activeToolText = NULL;
|
activeToolText = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
short texttool_text_is_active(Text *text) {
|
short texttool_text_is_active(Text *text)
|
||||||
|
{
|
||||||
return activeToolText==text ? 1 : 0;
|
return activeToolText==text ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +111,8 @@ short texttool_text_is_active(Text *text) {
|
|||||||
/* Suggestion list methods */
|
/* Suggestion list methods */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
void texttool_suggest_add(const char *name, char type) {
|
void texttool_suggest_add(const char *name, char type)
|
||||||
|
{
|
||||||
SuggItem *newitem, *item;
|
SuggItem *newitem, *item;
|
||||||
int len, cmp;
|
int len, cmp;
|
||||||
|
|
||||||
@@ -154,7 +162,8 @@ void texttool_suggest_add(const char *name, char type) {
|
|||||||
suggestions.top= 0;
|
suggestions.top= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_suggest_prefix(const char *prefix) {
|
void texttool_suggest_prefix(const char *prefix)
|
||||||
|
{
|
||||||
SuggItem *match, *first, *last;
|
SuggItem *match, *first, *last;
|
||||||
int cmp, len = strlen(prefix), top = 0;
|
int cmp, len = strlen(prefix), top = 0;
|
||||||
|
|
||||||
@@ -194,27 +203,33 @@ void texttool_suggest_prefix(const char *prefix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_suggest_clear(void) {
|
void texttool_suggest_clear(void)
|
||||||
|
{
|
||||||
txttl_free_suggest();
|
txttl_free_suggest();
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggItem *texttool_suggest_first(void) {
|
SuggItem *texttool_suggest_first(void)
|
||||||
|
{
|
||||||
return suggestions.firstmatch;
|
return suggestions.firstmatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggItem *texttool_suggest_last(void) {
|
SuggItem *texttool_suggest_last(void)
|
||||||
|
{
|
||||||
return suggestions.lastmatch;
|
return suggestions.lastmatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_suggest_select(SuggItem *sel) {
|
void texttool_suggest_select(SuggItem *sel)
|
||||||
|
{
|
||||||
suggestions.selected = sel;
|
suggestions.selected = sel;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggItem *texttool_suggest_selected(void) {
|
SuggItem *texttool_suggest_selected(void)
|
||||||
|
{
|
||||||
return suggestions.selected;
|
return suggestions.selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
int *texttool_suggest_top(void) {
|
int *texttool_suggest_top(void)
|
||||||
|
{
|
||||||
return &suggestions.top;
|
return &suggestions.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +237,8 @@ int *texttool_suggest_top(void) {
|
|||||||
/* Documentation methods */
|
/* Documentation methods */
|
||||||
/*************************/
|
/*************************/
|
||||||
|
|
||||||
void texttool_docs_show(const char *docs) {
|
void texttool_docs_show(const char *docs)
|
||||||
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (!docs) return;
|
if (!docs) return;
|
||||||
@@ -246,10 +262,12 @@ void texttool_docs_show(const char *docs) {
|
|||||||
documentation[len] = '\0';
|
documentation[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
char *texttool_docs_get(void) {
|
char *texttool_docs_get(void)
|
||||||
|
{
|
||||||
return documentation;
|
return documentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void texttool_docs_clear(void) {
|
void texttool_docs_clear(void)
|
||||||
|
{
|
||||||
txttl_free_docs();
|
txttl_free_docs();
|
||||||
}
|
}
|
||||||
|
@@ -2851,7 +2851,8 @@ void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsign
|
|||||||
/* Returns the first matching marker on the specified line between two points.
|
/* Returns the first matching marker on the specified line between two points.
|
||||||
If the group or flags fields are non-zero the returned flag must be in the
|
If the group or flags fields are non-zero the returned flag must be in the
|
||||||
specified group and have at least the specified flags set. */
|
specified group and have at least the specified flags set. */
|
||||||
TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) {
|
TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
|
||||||
|
{
|
||||||
TextMarker *marker, *next;
|
TextMarker *marker, *next;
|
||||||
int lineno= txt_get_span(text->lines.first, line);
|
int lineno= txt_get_span(text->lines.first, line);
|
||||||
|
|
||||||
@@ -2918,7 +2919,8 @@ short txt_clear_markers(Text *text, int group, int flags)
|
|||||||
|
|
||||||
/* Finds the marker at the specified line and cursor position with at least the
|
/* Finds the marker at the specified line and cursor position with at least the
|
||||||
specified flags set in the given group (if non-zero). */
|
specified flags set in the given group (if non-zero). */
|
||||||
TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags) {
|
TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags)
|
||||||
|
{
|
||||||
TextMarker *marker;
|
TextMarker *marker;
|
||||||
int lineno= txt_get_span(text->lines.first, line);
|
int lineno= txt_get_span(text->lines.first, line);
|
||||||
|
|
||||||
@@ -2936,7 +2938,8 @@ TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int
|
|||||||
|
|
||||||
/* Finds the previous marker in the same group. If no other is found, the same
|
/* Finds the previous marker in the same group. If no other is found, the same
|
||||||
marker will be returned */
|
marker will be returned */
|
||||||
TextMarker *txt_prev_marker(Text *text, TextMarker *marker) {
|
TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
|
||||||
|
{
|
||||||
TextMarker *tmp= marker;
|
TextMarker *tmp= marker;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (tmp->prev) tmp= tmp->prev;
|
if (tmp->prev) tmp= tmp->prev;
|
||||||
@@ -2949,7 +2952,8 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker) {
|
|||||||
|
|
||||||
/* Finds the next marker in the same group. If no other is found, the same
|
/* Finds the next marker in the same group. If no other is found, the same
|
||||||
marker will be returned */
|
marker will be returned */
|
||||||
TextMarker *txt_next_marker(Text *text, TextMarker *marker) {
|
TextMarker *txt_next_marker(Text *text, TextMarker *marker)
|
||||||
|
{
|
||||||
TextMarker *tmp= marker;
|
TextMarker *tmp= marker;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (tmp->next) tmp= tmp->next;
|
if (tmp->next) tmp= tmp->next;
|
||||||
|
@@ -150,7 +150,7 @@ typedef struct GHashPair {
|
|||||||
GHashPair* BLI_ghashutil_pairalloc (const void *first, int second);
|
GHashPair* BLI_ghashutil_pairalloc (const void *first, int second);
|
||||||
unsigned int BLI_ghashutil_pairhash (const void *ptr);
|
unsigned int BLI_ghashutil_pairhash (const void *ptr);
|
||||||
int BLI_ghashutil_paircmp (const void *a, const void *b);
|
int BLI_ghashutil_paircmp (const void *a, const void *b);
|
||||||
void BLI_ghashutil_pairfree (const void *ptr);
|
void BLI_ghashutil_pairfree (void *ptr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,8 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr)
|
|||||||
ds->curlen+= cstrlen;
|
ds->curlen+= cstrlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) {
|
void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len)
|
||||||
|
{
|
||||||
DynStrElem *dse= malloc(sizeof(*dse));
|
DynStrElem *dse= malloc(sizeof(*dse));
|
||||||
int cstrlen= BLI_strnlen(cstr, len);
|
int cstrlen= BLI_strnlen(cstr, len);
|
||||||
|
|
||||||
@@ -225,7 +226,8 @@ int BLI_dynstr_get_len(DynStr *ds)
|
|||||||
return ds->curlen;
|
return ds->curlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *BLI_dynstr_get_cstring(DynStr *ds) {
|
char *BLI_dynstr_get_cstring(DynStr *ds)
|
||||||
|
{
|
||||||
char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
|
char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring");
|
||||||
DynStrElem *dse;
|
DynStrElem *dse;
|
||||||
|
|
||||||
@@ -241,7 +243,8 @@ char *BLI_dynstr_get_cstring(DynStr *ds) {
|
|||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_dynstr_free(DynStr *ds) {
|
void BLI_dynstr_free(DynStr *ds)
|
||||||
|
{
|
||||||
DynStrElem *dse;
|
DynStrElem *dse;
|
||||||
|
|
||||||
for (dse= ds->elems; dse; ) {
|
for (dse= ds->elems; dse; ) {
|
||||||
|
@@ -56,7 +56,8 @@ static unsigned int hashsizes[]= {
|
|||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
|
GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
|
||||||
|
{
|
||||||
GHash *gh= MEM_mallocN(sizeof(*gh), info);
|
GHash *gh= MEM_mallocN(sizeof(*gh), info);
|
||||||
gh->hashfp= hashfp;
|
gh->hashfp= hashfp;
|
||||||
gh->cmpfp= cmpfp;
|
gh->cmpfp= cmpfp;
|
||||||
@@ -72,11 +73,13 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
|
|||||||
return gh;
|
return gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_ghash_size(GHash *gh) {
|
int BLI_ghash_size(GHash *gh)
|
||||||
|
{
|
||||||
return gh->nentries;
|
return gh->nentries;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_ghash_insert(GHash *gh, void *key, void *val) {
|
void BLI_ghash_insert(GHash *gh, void *key, void *val)
|
||||||
|
{
|
||||||
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
||||||
Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
|
Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
|
||||||
|
|
||||||
@@ -109,7 +112,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *BLI_ghash_lookup(GHash *gh, const void *key) {
|
void *BLI_ghash_lookup(GHash *gh, const void *key)
|
||||||
|
{
|
||||||
if(gh) {
|
if(gh) {
|
||||||
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
@@ -151,7 +155,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_ghash_haskey(GHash *gh, void *key) {
|
int BLI_ghash_haskey(GHash *gh, void *key)
|
||||||
|
{
|
||||||
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
|
|
||||||
@@ -162,7 +167,8 @@ int BLI_ghash_haskey(GHash *gh, void *key) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) {
|
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (keyfreefp || valfreefp) {
|
if (keyfreefp || valfreefp) {
|
||||||
@@ -190,7 +196,8 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
|
|||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
GHashIterator *BLI_ghashIterator_new(GHash *gh) {
|
GHashIterator *BLI_ghashIterator_new(GHash *gh)
|
||||||
|
{
|
||||||
GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
|
GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
|
||||||
ghi->gh= gh;
|
ghi->gh= gh;
|
||||||
ghi->curEntry= NULL;
|
ghi->curEntry= NULL;
|
||||||
@@ -203,7 +210,8 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh) {
|
|||||||
}
|
}
|
||||||
return ghi;
|
return ghi;
|
||||||
}
|
}
|
||||||
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
|
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
|
||||||
|
{
|
||||||
ghi->gh= gh;
|
ghi->gh= gh;
|
||||||
ghi->curEntry= NULL;
|
ghi->curEntry= NULL;
|
||||||
ghi->curBucket= -1;
|
ghi->curBucket= -1;
|
||||||
@@ -214,18 +222,22 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
|
|||||||
ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
|
ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void BLI_ghashIterator_free(GHashIterator *ghi) {
|
void BLI_ghashIterator_free(GHashIterator *ghi)
|
||||||
|
{
|
||||||
MEM_freeN(ghi);
|
MEM_freeN(ghi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *BLI_ghashIterator_getKey(GHashIterator *ghi) {
|
void *BLI_ghashIterator_getKey(GHashIterator *ghi)
|
||||||
|
{
|
||||||
return ghi->curEntry?ghi->curEntry->key:NULL;
|
return ghi->curEntry?ghi->curEntry->key:NULL;
|
||||||
}
|
}
|
||||||
void *BLI_ghashIterator_getValue(GHashIterator *ghi) {
|
void *BLI_ghashIterator_getValue(GHashIterator *ghi)
|
||||||
|
{
|
||||||
return ghi->curEntry?ghi->curEntry->val:NULL;
|
return ghi->curEntry?ghi->curEntry->val:NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_ghashIterator_step(GHashIterator *ghi) {
|
void BLI_ghashIterator_step(GHashIterator *ghi)
|
||||||
|
{
|
||||||
if (ghi->curEntry) {
|
if (ghi->curEntry) {
|
||||||
ghi->curEntry= ghi->curEntry->next;
|
ghi->curEntry= ghi->curEntry->next;
|
||||||
while (!ghi->curEntry) {
|
while (!ghi->curEntry) {
|
||||||
@@ -236,23 +248,27 @@ void BLI_ghashIterator_step(GHashIterator *ghi) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int BLI_ghashIterator_isDone(GHashIterator *ghi) {
|
int BLI_ghashIterator_isDone(GHashIterator *ghi)
|
||||||
|
{
|
||||||
return !ghi->curEntry;
|
return !ghi->curEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
unsigned int BLI_ghashutil_ptrhash(const void *key) {
|
unsigned int BLI_ghashutil_ptrhash(const void *key)
|
||||||
|
{
|
||||||
return (unsigned int)(intptr_t)key;
|
return (unsigned int)(intptr_t)key;
|
||||||
}
|
}
|
||||||
int BLI_ghashutil_ptrcmp(const void *a, const void *b) {
|
int BLI_ghashutil_ptrcmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
if (a==b)
|
if (a==b)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return (a<b)?-1:1;
|
return (a<b)?-1:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BLI_ghashutil_inthash(const void *ptr) {
|
unsigned int BLI_ghashutil_inthash(const void *ptr)
|
||||||
|
{
|
||||||
uintptr_t key = (uintptr_t)ptr;
|
uintptr_t key = (uintptr_t)ptr;
|
||||||
|
|
||||||
key += ~(key << 16);
|
key += ~(key << 16);
|
||||||
@@ -265,14 +281,16 @@ unsigned int BLI_ghashutil_inthash(const void *ptr) {
|
|||||||
return (unsigned int)(key & 0xffffffff);
|
return (unsigned int)(key & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_ghashutil_intcmp(const void *a, const void *b) {
|
int BLI_ghashutil_intcmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
if (a==b)
|
if (a==b)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return (a<b)?-1:1;
|
return (a<b)?-1:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BLI_ghashutil_strhash(const void *ptr) {
|
unsigned int BLI_ghashutil_strhash(const void *ptr)
|
||||||
|
{
|
||||||
const char *s= ptr;
|
const char *s= ptr;
|
||||||
unsigned int i= 0;
|
unsigned int i= 0;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
@@ -282,24 +300,28 @@ unsigned int BLI_ghashutil_strhash(const void *ptr) {
|
|||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
int BLI_ghashutil_strcmp(const void *a, const void *b) {
|
int BLI_ghashutil_strcmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
return strcmp(a, b);
|
return strcmp(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHashPair *BLI_ghashutil_pairalloc(const void *first, int second) {
|
GHashPair *BLI_ghashutil_pairalloc(const void *first, int second)
|
||||||
|
{
|
||||||
GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
|
GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
|
||||||
pair->first = first;
|
pair->first = first;
|
||||||
pair->second = second;
|
pair->second = second;
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BLI_ghashutil_pairhash(const void *ptr) {
|
unsigned int BLI_ghashutil_pairhash(const void *ptr)
|
||||||
|
{
|
||||||
const GHashPair *pair = ptr;
|
const GHashPair *pair = ptr;
|
||||||
unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
|
unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
|
||||||
return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
|
return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_ghashutil_paircmp(const void *a, const void *b) {
|
int BLI_ghashutil_paircmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
const GHashPair *A = a;
|
const GHashPair *A = a;
|
||||||
const GHashPair *B = b;
|
const GHashPair *B = b;
|
||||||
|
|
||||||
@@ -309,7 +331,8 @@ int BLI_ghashutil_paircmp(const void *a, const void *b) {
|
|||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_ghashutil_pairfree(const void *ptr) {
|
void BLI_ghashutil_pairfree(void *ptr)
|
||||||
|
{
|
||||||
MEM_freeN((void*)ptr);
|
MEM_freeN((void*)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,7 +35,8 @@
|
|||||||
#include "BLI_linklist.h"
|
#include "BLI_linklist.h"
|
||||||
#include "BLI_memarena.h"
|
#include "BLI_memarena.h"
|
||||||
|
|
||||||
int BLI_linklist_length(LinkNode *list) {
|
int BLI_linklist_length(LinkNode *list)
|
||||||
|
{
|
||||||
if (0) {
|
if (0) {
|
||||||
return list?(1+BLI_linklist_length(list->next)):0;
|
return list?(1+BLI_linklist_length(list->next)):0;
|
||||||
} else {
|
} else {
|
||||||
@@ -70,7 +71,8 @@ LinkNode *BLI_linklist_find(LinkNode *list, int index)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_reverse(LinkNode **listp) {
|
void BLI_linklist_reverse(LinkNode **listp)
|
||||||
|
{
|
||||||
LinkNode *rhead= NULL, *cur= *listp;
|
LinkNode *rhead= NULL, *cur= *listp;
|
||||||
|
|
||||||
while (cur) {
|
while (cur) {
|
||||||
@@ -85,7 +87,8 @@ void BLI_linklist_reverse(LinkNode **listp) {
|
|||||||
*listp= rhead;
|
*listp= rhead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
|
void BLI_linklist_prepend(LinkNode **listp, void *ptr)
|
||||||
|
{
|
||||||
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
||||||
nlink->link= ptr;
|
nlink->link= ptr;
|
||||||
|
|
||||||
@@ -93,7 +96,8 @@ void BLI_linklist_prepend(LinkNode **listp, void *ptr) {
|
|||||||
*listp= nlink;
|
*listp= nlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_append(LinkNode **listp, void *ptr) {
|
void BLI_linklist_append(LinkNode **listp, void *ptr)
|
||||||
|
{
|
||||||
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
||||||
LinkNode *node = *listp;
|
LinkNode *node = *listp;
|
||||||
|
|
||||||
@@ -110,7 +114,8 @@ void BLI_linklist_append(LinkNode **listp, void *ptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
|
void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma)
|
||||||
|
{
|
||||||
LinkNode *nlink= BLI_memarena_alloc(ma, sizeof(*nlink));
|
LinkNode *nlink= BLI_memarena_alloc(ma, sizeof(*nlink));
|
||||||
nlink->link= ptr;
|
nlink->link= ptr;
|
||||||
|
|
||||||
@@ -118,7 +123,8 @@ void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
|
|||||||
*listp= nlink;
|
*listp= nlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
|
void BLI_linklist_insert_after(LinkNode **listp, void *ptr)
|
||||||
|
{
|
||||||
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
|
||||||
LinkNode *node = *listp;
|
LinkNode *node = *listp;
|
||||||
|
|
||||||
@@ -134,7 +140,8 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
|
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
|
||||||
|
{
|
||||||
while (list) {
|
while (list) {
|
||||||
LinkNode *next= list->next;
|
LinkNode *next= list->next;
|
||||||
|
|
||||||
@@ -146,7 +153,8 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata) {
|
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata)
|
||||||
|
{
|
||||||
for (; list; list= list->next)
|
for (; list; list= list->next)
|
||||||
applyfunc(list->link, userdata);
|
applyfunc(list->link, userdata);
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,8 @@ struct MemArena {
|
|||||||
LinkNode *bufs;
|
LinkNode *bufs;
|
||||||
};
|
};
|
||||||
|
|
||||||
MemArena *BLI_memarena_new(int bufsize, const char *name) {
|
MemArena *BLI_memarena_new(int bufsize, const char *name)
|
||||||
|
{
|
||||||
MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
|
MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
|
||||||
ma->bufsize= bufsize;
|
ma->bufsize= bufsize;
|
||||||
ma->align = 8;
|
ma->align = 8;
|
||||||
@@ -57,20 +58,24 @@ MemArena *BLI_memarena_new(int bufsize, const char *name) {
|
|||||||
return ma;
|
return ma;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_memarena_use_calloc(MemArena *ma) {
|
void BLI_memarena_use_calloc(MemArena *ma)
|
||||||
|
{
|
||||||
ma->use_calloc= 1;
|
ma->use_calloc= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_memarena_use_malloc(MemArena *ma) {
|
void BLI_memarena_use_malloc(MemArena *ma)
|
||||||
|
{
|
||||||
ma->use_calloc= 0;
|
ma->use_calloc= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_memarena_use_align(struct MemArena *ma, int align) {
|
void BLI_memarena_use_align(struct MemArena *ma, int align)
|
||||||
|
{
|
||||||
/* align should be a power of two */
|
/* align should be a power of two */
|
||||||
ma->align = align;
|
ma->align = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_memarena_free(MemArena *ma) {
|
void BLI_memarena_free(MemArena *ma)
|
||||||
|
{
|
||||||
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
|
BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
|
||||||
MEM_freeN(ma);
|
MEM_freeN(ma);
|
||||||
}
|
}
|
||||||
@@ -78,7 +83,8 @@ void BLI_memarena_free(MemArena *ma) {
|
|||||||
/* amt must be power of two */
|
/* amt must be power of two */
|
||||||
#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
|
#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
|
||||||
|
|
||||||
void *BLI_memarena_alloc(MemArena *ma, int size) {
|
void *BLI_memarena_alloc(MemArena *ma, int size)
|
||||||
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
/* ensure proper alignment by rounding
|
/* ensure proper alignment by rounding
|
||||||
|
@@ -64,7 +64,8 @@ struct EdgeHash {
|
|||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
EdgeHash *BLI_edgehash_new(void) {
|
EdgeHash *BLI_edgehash_new(void)
|
||||||
|
{
|
||||||
EdgeHash *eh= MEM_mallocN(sizeof(*eh), "EdgeHash");
|
EdgeHash *eh= MEM_mallocN(sizeof(*eh), "EdgeHash");
|
||||||
eh->cursize= 0;
|
eh->cursize= 0;
|
||||||
eh->nentries= 0;
|
eh->nentries= 0;
|
||||||
@@ -76,7 +77,8 @@ EdgeHash *BLI_edgehash_new(void) {
|
|||||||
return eh;
|
return eh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
|
void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val)
|
||||||
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
Entry *e= malloc(sizeof(*e));
|
Entry *e= malloc(sizeof(*e));
|
||||||
|
|
||||||
@@ -117,7 +119,8 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) {
|
void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1)
|
||||||
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
|
|
||||||
@@ -134,21 +137,25 @@ void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1) {
|
void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1)
|
||||||
|
{
|
||||||
void **value_p = BLI_edgehash_lookup_p(eh,v0,v1);
|
void **value_p = BLI_edgehash_lookup_p(eh,v0,v1);
|
||||||
|
|
||||||
return value_p?*value_p:NULL;
|
return value_p?*value_p:NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1) {
|
int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1)
|
||||||
|
{
|
||||||
return BLI_edgehash_lookup_p(eh, v0, v1)!=NULL;
|
return BLI_edgehash_lookup_p(eh, v0, v1)!=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_edgehash_size(EdgeHash *eh) {
|
int BLI_edgehash_size(EdgeHash *eh)
|
||||||
|
{
|
||||||
return eh->nentries;
|
return eh->nentries;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
|
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<eh->nbuckets; i++) {
|
for (i=0; i<eh->nbuckets; i++) {
|
||||||
@@ -168,7 +175,8 @@ void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
|
|||||||
eh->nentries= 0;
|
eh->nentries= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp) {
|
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp)
|
||||||
|
{
|
||||||
BLI_edgehash_clear(eh, valfreefp);
|
BLI_edgehash_clear(eh, valfreefp);
|
||||||
|
|
||||||
free(eh->buckets);
|
free(eh->buckets);
|
||||||
@@ -184,7 +192,8 @@ struct EdgeHashIterator {
|
|||||||
Entry *curEntry;
|
Entry *curEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
|
EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh)
|
||||||
|
{
|
||||||
EdgeHashIterator *ehi= malloc(sizeof(*ehi));
|
EdgeHashIterator *ehi= malloc(sizeof(*ehi));
|
||||||
ehi->eh= eh;
|
ehi->eh= eh;
|
||||||
ehi->curEntry= NULL;
|
ehi->curEntry= NULL;
|
||||||
@@ -197,26 +206,31 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) {
|
|||||||
}
|
}
|
||||||
return ehi;
|
return ehi;
|
||||||
}
|
}
|
||||||
void BLI_edgehashIterator_free(EdgeHashIterator *ehi) {
|
void BLI_edgehashIterator_free(EdgeHashIterator *ehi)
|
||||||
|
{
|
||||||
free(ehi);
|
free(ehi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r) {
|
void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r)
|
||||||
|
{
|
||||||
if (ehi->curEntry) {
|
if (ehi->curEntry) {
|
||||||
*v0_r = ehi->curEntry->v0;
|
*v0_r = ehi->curEntry->v0;
|
||||||
*v1_r = ehi->curEntry->v1;
|
*v1_r = ehi->curEntry->v1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) {
|
void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
|
||||||
|
{
|
||||||
return ehi->curEntry?ehi->curEntry->val:NULL;
|
return ehi->curEntry?ehi->curEntry->val:NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) {
|
void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val)
|
||||||
|
{
|
||||||
if(ehi->curEntry)
|
if(ehi->curEntry)
|
||||||
ehi->curEntry->val= val;
|
ehi->curEntry->val= val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
|
void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
|
||||||
|
{
|
||||||
if (ehi->curEntry) {
|
if (ehi->curEntry) {
|
||||||
ehi->curEntry= ehi->curEntry->next;
|
ehi->curEntry= ehi->curEntry->next;
|
||||||
while (!ehi->curEntry) {
|
while (!ehi->curEntry) {
|
||||||
@@ -227,7 +241,8 @@ void BLI_edgehashIterator_step(EdgeHashIterator *ehi) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) {
|
int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
|
||||||
|
{
|
||||||
return !ehi->curEntry;
|
return !ehi->curEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,11 +78,13 @@ void rng_free(RNG* rng)
|
|||||||
MEM_freeN(rng);
|
MEM_freeN(rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rng_seed(RNG *rng, unsigned int seed) {
|
void rng_seed(RNG *rng, unsigned int seed)
|
||||||
|
{
|
||||||
rng->X= (((r_uint64) seed)<<16) | LOWSEED;
|
rng->X= (((r_uint64) seed)<<16) | LOWSEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rng_srandom(RNG *rng, unsigned int seed) {
|
void rng_srandom(RNG *rng, unsigned int seed)
|
||||||
|
{
|
||||||
rng_seed(rng, seed + hash[seed & 255]);
|
rng_seed(rng, seed + hash[seed & 255]);
|
||||||
seed= rng_getInt(rng);
|
seed= rng_getInt(rng);
|
||||||
rng_seed(rng, seed + hash[seed & 255]);
|
rng_seed(rng, seed + hash[seed & 255]);
|
||||||
@@ -90,16 +92,19 @@ void rng_srandom(RNG *rng, unsigned int seed) {
|
|||||||
rng_seed(rng, seed + hash[seed & 255]);
|
rng_seed(rng, seed + hash[seed & 255]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rng_getInt(RNG *rng) {
|
int rng_getInt(RNG *rng)
|
||||||
|
{
|
||||||
rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK;
|
rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK;
|
||||||
return (int) (rng->X>>17);
|
return (int) (rng->X>>17);
|
||||||
}
|
}
|
||||||
|
|
||||||
double rng_getDouble(RNG *rng) {
|
double rng_getDouble(RNG *rng)
|
||||||
|
{
|
||||||
return (double) rng_getInt(rng)/0x80000000;
|
return (double) rng_getInt(rng)/0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
float rng_getFloat(RNG *rng) {
|
float rng_getFloat(RNG *rng)
|
||||||
|
{
|
||||||
return (float) rng_getInt(rng)/0x80000000;
|
return (float) rng_getInt(rng)/0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,28 +140,34 @@ void rng_skip(RNG *rng, int n)
|
|||||||
static RNG theBLI_rng = {0};
|
static RNG theBLI_rng = {0};
|
||||||
|
|
||||||
/* note, this one creates periodical patterns */
|
/* note, this one creates periodical patterns */
|
||||||
void BLI_srand(unsigned int seed) {
|
void BLI_srand(unsigned int seed)
|
||||||
|
{
|
||||||
rng_seed(&theBLI_rng, seed);
|
rng_seed(&theBLI_rng, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* using hash table to create better seed */
|
/* using hash table to create better seed */
|
||||||
void BLI_srandom(unsigned int seed) {
|
void BLI_srandom(unsigned int seed)
|
||||||
|
{
|
||||||
rng_srandom(&theBLI_rng, seed);
|
rng_srandom(&theBLI_rng, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_rand(void) {
|
int BLI_rand(void)
|
||||||
|
{
|
||||||
return rng_getInt(&theBLI_rng);
|
return rng_getInt(&theBLI_rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
double BLI_drand(void) {
|
double BLI_drand(void)
|
||||||
|
{
|
||||||
return rng_getDouble(&theBLI_rng);
|
return rng_getDouble(&theBLI_rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BLI_frand(void) {
|
float BLI_frand(void)
|
||||||
|
{
|
||||||
return rng_getFloat(&theBLI_rng);
|
return rng_getFloat(&theBLI_rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_fillrand(void *addr, int len) {
|
void BLI_fillrand(void *addr, int len)
|
||||||
|
{
|
||||||
RNG rng;
|
RNG rng;
|
||||||
unsigned char *p= addr;
|
unsigned char *p= addr;
|
||||||
|
|
||||||
@@ -188,11 +199,13 @@ void BLI_thread_srandom(int thread, unsigned int seed)
|
|||||||
rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
|
rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_thread_rand(int thread) {
|
int BLI_thread_rand(int thread)
|
||||||
|
{
|
||||||
return rng_getInt(&rng_tab[thread]);
|
return rng_getInt(&rng_tab[thread]);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BLI_thread_frand(int thread) {
|
float BLI_thread_frand(int thread)
|
||||||
|
{
|
||||||
return rng_getFloat(&rng_tab[thread]);
|
return rng_getFloat(&rng_tab[thread]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,8 @@
|
|||||||
|
|
||||||
/* FILE_MAX */
|
/* FILE_MAX */
|
||||||
|
|
||||||
int BLI_getInstallationDir( char * str ) {
|
int BLI_getInstallationDir( char * str )
|
||||||
|
{
|
||||||
char dir[FILE_MAXDIR];
|
char dir[FILE_MAXDIR];
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
@@ -73,7 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root)
|
|||||||
TerminateProcess(GetCurrentProcess(),1);
|
TerminateProcess(GetCurrentProcess(),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterBlendExtension(void) {
|
void RegisterBlendExtension(void)
|
||||||
|
{
|
||||||
LONG lresult;
|
LONG lresult;
|
||||||
HKEY hkey = 0;
|
HKEY hkey = 0;
|
||||||
HKEY root = 0;
|
HKEY root = 0;
|
||||||
@@ -167,7 +169,8 @@ void RegisterBlendExtension(void) {
|
|||||||
TerminateProcess(GetCurrentProcess(),0);
|
TerminateProcess(GetCurrentProcess(),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIR *opendir (const char *path) {
|
DIR *opendir (const char *path)
|
||||||
|
{
|
||||||
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
|
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
|
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
|
||||||
|
|
||||||
@@ -185,7 +188,8 @@ DIR *opendir (const char *path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dirent *readdir(DIR *dp) {
|
struct dirent *readdir(DIR *dp)
|
||||||
|
{
|
||||||
if (dp->direntry.d_name) {
|
if (dp->direntry.d_name) {
|
||||||
MEM_freeN(dp->direntry.d_name);
|
MEM_freeN(dp->direntry.d_name);
|
||||||
dp->direntry.d_name= NULL;
|
dp->direntry.d_name= NULL;
|
||||||
@@ -208,7 +212,8 @@ struct dirent *readdir(DIR *dp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int closedir (DIR *dp) {
|
int closedir (DIR *dp)
|
||||||
|
{
|
||||||
if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name);
|
if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name);
|
||||||
if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle);
|
if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle);
|
||||||
|
|
||||||
@@ -217,7 +222,8 @@ int closedir (DIR *dp) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_default_root(char* root) {
|
void get_default_root(char* root)
|
||||||
|
{
|
||||||
char str[MAX_PATH+1];
|
char str[MAX_PATH+1];
|
||||||
|
|
||||||
/* the default drive to resolve a directory without a specified drive
|
/* the default drive to resolve a directory without a specified drive
|
||||||
|
@@ -534,7 +534,8 @@ void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
|
|||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare(const void * a, const void * b){
|
static int compare(const void * a, const void * b)
|
||||||
|
{
|
||||||
return ( *(int*)a - *(int*)b );
|
return ( *(int*)a - *(int*)b );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,7 +59,8 @@
|
|||||||
|
|
||||||
#include "physics_intern.h"
|
#include "physics_intern.h"
|
||||||
|
|
||||||
static int cache_break_test(void *UNUSED(cbd)) {
|
static int cache_break_test(void *UNUSED(cbd))
|
||||||
|
{
|
||||||
return G.afbreek==1;
|
return G.afbreek==1;
|
||||||
}
|
}
|
||||||
static int ptcache_bake_all_poll(bContext *C)
|
static int ptcache_bake_all_poll(bContext *C)
|
||||||
|
@@ -376,7 +376,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
|
|||||||
|
|
||||||
/* ************************** TRANSFORMATIONS **************************** */
|
/* ************************** TRANSFORMATIONS **************************** */
|
||||||
|
|
||||||
void BIF_selectOrientation(void) {
|
void BIF_selectOrientation(void)
|
||||||
|
{
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
#if 0 // TRANSFORM_FIX_ME
|
||||||
short val;
|
short val;
|
||||||
char *str_menu = BIF_menustringTransformOrientation("Orientation");
|
char *str_menu = BIF_menustringTransformOrientation("Orientation");
|
||||||
@@ -2547,7 +2548,8 @@ void initResize(TransInfo *t)
|
|||||||
t->num.increment = t->snap[1];
|
t->num.increment = t->snap[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void headerResize(TransInfo *t, float vec[3], char *str) {
|
static void headerResize(TransInfo *t, float vec[3], char *str)
|
||||||
|
{
|
||||||
char tvec[60];
|
char tvec[60];
|
||||||
char *spos= str;
|
char *spos= str;
|
||||||
if (hasNumInput(&t->num)) {
|
if (hasNumInput(&t->num)) {
|
||||||
@@ -2607,7 +2609,8 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
|
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
|
||||||
|
{
|
||||||
float tmat[3][3], smat[3][3], center[3];
|
float tmat[3][3], smat[3][3], center[3];
|
||||||
float vec[3];
|
float vec[3];
|
||||||
|
|
||||||
@@ -2904,7 +2907,8 @@ void initRotation(TransInfo *t)
|
|||||||
copy_v3_v3(t->axis_orig, t->axis);
|
copy_v3_v3(t->axis_orig, t->axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) {
|
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around)
|
||||||
|
{
|
||||||
float vec[3], totmat[3][3], smat[3][3];
|
float vec[3], totmat[3][3], smat[3][3];
|
||||||
float eul[3], fmat[3][3], quat[4];
|
float eul[3], fmat[3][3], quat[4];
|
||||||
float *center = t->center;
|
float *center = t->center;
|
||||||
@@ -3344,7 +3348,8 @@ void initTranslation(TransInfo *t)
|
|||||||
t->num.increment = t->snap[1];
|
t->num.increment = t->snap[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void headerTranslation(TransInfo *t, float vec[3], char *str) {
|
static void headerTranslation(TransInfo *t, float vec[3], char *str)
|
||||||
|
{
|
||||||
char *spos= str;
|
char *spos= str;
|
||||||
char tvec[60];
|
char tvec[60];
|
||||||
char distvec[20];
|
char distvec[20];
|
||||||
@@ -3418,7 +3423,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
|
|||||||
(void)spos;
|
(void)spos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyTranslation(TransInfo *t, float vec[3]) {
|
static void applyTranslation(TransInfo *t, float vec[3])
|
||||||
|
{
|
||||||
TransData *td = t->data;
|
TransData *td = t->data;
|
||||||
float tvec[3];
|
float tvec[3];
|
||||||
int i;
|
int i;
|
||||||
@@ -4099,7 +4105,8 @@ void initBoneSize(TransInfo *t)
|
|||||||
t->num.increment = t->snap[1];
|
t->num.increment = t->snap[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void headerBoneSize(TransInfo *t, float vec[3], char *str) {
|
static void headerBoneSize(TransInfo *t, float vec[3], char *str)
|
||||||
|
{
|
||||||
char tvec[60];
|
char tvec[60];
|
||||||
if (hasNumInput(&t->num)) {
|
if (hasNumInput(&t->num)) {
|
||||||
outputNumInput(&(t->num), tvec);
|
outputNumInput(&(t->num), tvec);
|
||||||
@@ -5302,7 +5309,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str)
|
|||||||
sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
|
sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applySeqSlide(TransInfo *t, float val[2]) {
|
static void applySeqSlide(TransInfo *t, float val[2])
|
||||||
|
{
|
||||||
TransData *td = t->data;
|
TransData *td = t->data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -5826,7 +5834,8 @@ void initTimeScale(TransInfo *t)
|
|||||||
t->num.increment = t->snap[1];
|
t->num.increment = t->snap[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void headerTimeScale(TransInfo *t, char *str) {
|
static void headerTimeScale(TransInfo *t, char *str)
|
||||||
|
{
|
||||||
char tvec[60];
|
char tvec[60];
|
||||||
|
|
||||||
if (hasNumInput(&t->num))
|
if (hasNumInput(&t->num))
|
||||||
@@ -5837,7 +5846,8 @@ static void headerTimeScale(TransInfo *t, char *str) {
|
|||||||
sprintf(str, "ScaleX: %s", &tvec[0]);
|
sprintf(str, "ScaleX: %s", &tvec[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyTimeScale(TransInfo *t) {
|
static void applyTimeScale(TransInfo *t)
|
||||||
|
{
|
||||||
Scene *scene = t->scene;
|
Scene *scene = t->scene;
|
||||||
TransData *td = t->data;
|
TransData *td = t->data;
|
||||||
TransData2D *td2d = t->data2d;
|
TransData2D *td2d = t->data2d;
|
||||||
|
@@ -138,7 +138,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
|
static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
|
||||||
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
mul_m3_v3(t->con.imtx, vec);
|
mul_m3_v3(t->con.imtx, vec);
|
||||||
@@ -209,7 +210,8 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
|
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3])
|
||||||
|
{
|
||||||
float norm[3], vec[3], factor, angle;
|
float norm[3], vec[3], factor, angle;
|
||||||
float t_con_center[3];
|
float t_con_center[3];
|
||||||
|
|
||||||
@@ -284,7 +286,8 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void planeProjection(TransInfo *t, float in[3], float out[3]) {
|
static void planeProjection(TransInfo *t, float in[3], float out[3])
|
||||||
|
{
|
||||||
float vec[3], factor, norm[3];
|
float vec[3], factor, norm[3];
|
||||||
|
|
||||||
add_v3_v3v3(vec, in, t->con.center);
|
add_v3_v3v3(vec, in, t->con.center);
|
||||||
@@ -547,7 +550,8 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
|
|||||||
|
|
||||||
/*--------------------- INTERNAL SETUP CALLS ------------------*/
|
/*--------------------- INTERNAL SETUP CALLS ------------------*/
|
||||||
|
|
||||||
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) {
|
void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
|
||||||
|
{
|
||||||
strncpy(t->con.text + 1, text, 48);
|
strncpy(t->con.text + 1, text, 48);
|
||||||
copy_m3_m3(t->con.mtx, space);
|
copy_m3_m3(t->con.mtx, space);
|
||||||
t->con.mode = mode;
|
t->con.mode = mode;
|
||||||
@@ -562,7 +566,8 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
|
|||||||
t->redraw = 1;
|
t->redraw = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
|
void setLocalConstraint(TransInfo *t, int mode, const char text[])
|
||||||
|
{
|
||||||
if (t->flag & T_EDIT) {
|
if (t->flag & T_EDIT) {
|
||||||
float obmat[3][3];
|
float obmat[3][3];
|
||||||
copy_m3_m4(obmat, t->scene->obedit->obmat);
|
copy_m3_m4(obmat, t->scene->obedit->obmat);
|
||||||
@@ -596,7 +601,8 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
|
|||||||
ftext is a format string passed to sprintf. It will add the name of
|
ftext is a format string passed to sprintf. It will add the name of
|
||||||
the orientation where %s is (logically).
|
the orientation where %s is (logically).
|
||||||
*/
|
*/
|
||||||
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) {
|
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
|
||||||
|
{
|
||||||
char text[40];
|
char text[40];
|
||||||
|
|
||||||
switch(orientation) {
|
switch(orientation) {
|
||||||
@@ -744,7 +750,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawObjectConstraint(TransInfo *t) {
|
static void drawObjectConstraint(TransInfo *t)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
TransData * td = t->data;
|
TransData * td = t->data;
|
||||||
|
|
||||||
@@ -781,13 +788,15 @@ static void drawObjectConstraint(TransInfo *t) {
|
|||||||
|
|
||||||
/*--------------------- START / STOP CONSTRAINTS ---------------------- */
|
/*--------------------- START / STOP CONSTRAINTS ---------------------- */
|
||||||
|
|
||||||
void startConstraint(TransInfo *t) {
|
void startConstraint(TransInfo *t)
|
||||||
|
{
|
||||||
t->con.mode |= CON_APPLY;
|
t->con.mode |= CON_APPLY;
|
||||||
*t->con.text = ' ';
|
*t->con.text = ' ';
|
||||||
t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max);
|
t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopConstraint(TransInfo *t) {
|
void stopConstraint(TransInfo *t)
|
||||||
|
{
|
||||||
t->con.mode &= ~(CON_APPLY|CON_SELECT);
|
t->con.mode &= ~(CON_APPLY|CON_SELECT);
|
||||||
*t->con.text = '\0';
|
*t->con.text = '\0';
|
||||||
t->num.idx_max = t->idx_max;
|
t->num.idx_max = t->idx_max;
|
||||||
@@ -836,7 +845,8 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3])
|
|||||||
t->con.applyRot = applyAxisConstraintRot;
|
t->con.applyRot = applyAxisConstraintRot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectConstraint(TransInfo *t) {
|
void selectConstraint(TransInfo *t)
|
||||||
|
{
|
||||||
if (t->con.mode & CON_SELECT) {
|
if (t->con.mode & CON_SELECT) {
|
||||||
setNearestAxis(t);
|
setNearestAxis(t);
|
||||||
startConstraint(t);
|
startConstraint(t);
|
||||||
@@ -970,7 +980,8 @@ void setNearestAxis(TransInfo *t)
|
|||||||
|
|
||||||
/*-------------- HELPER FUNCTIONS ----------------*/
|
/*-------------- HELPER FUNCTIONS ----------------*/
|
||||||
|
|
||||||
char constraintModeToChar(TransInfo *t) {
|
char constraintModeToChar(TransInfo *t)
|
||||||
|
{
|
||||||
if ((t->con.mode & CON_APPLY)==0) {
|
if ((t->con.mode & CON_APPLY)==0) {
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
@@ -990,7 +1001,8 @@ char constraintModeToChar(TransInfo *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int isLockConstraint(TransInfo *t) {
|
int isLockConstraint(TransInfo *t)
|
||||||
|
{
|
||||||
int mode = t->con.mode;
|
int mode = t->con.mode;
|
||||||
|
|
||||||
if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1))
|
if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1))
|
||||||
|
@@ -118,7 +118,8 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list);
|
|||||||
|
|
||||||
/* ************************** Functions *************************** */
|
/* ************************** Functions *************************** */
|
||||||
|
|
||||||
static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) {
|
static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp)
|
||||||
|
{
|
||||||
TransData *ihead = head;
|
TransData *ihead = head;
|
||||||
TransData *itail = tail;
|
TransData *itail = tail;
|
||||||
*temp = *head;
|
*temp = *head;
|
||||||
@@ -165,7 +166,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort_trans_data_dist(TransInfo *t) {
|
void sort_trans_data_dist(TransInfo *t)
|
||||||
|
{
|
||||||
TransData temp;
|
TransData temp;
|
||||||
TransData *start = t->data;
|
TransData *start = t->data;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@@ -1326,7 +1328,8 @@ static void createTransMBallVerts(TransInfo *t)
|
|||||||
|
|
||||||
/* ********************* curve/surface ********* */
|
/* ********************* curve/surface ********* */
|
||||||
|
|
||||||
static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
static void calc_distanceCurveVerts(TransData *head, TransData *tail)
|
||||||
|
{
|
||||||
TransData *td, *td_near = NULL;
|
TransData *td, *td_near = NULL;
|
||||||
for (td = head; td<=tail; td++) {
|
for (td = head; td<=tail; td++) {
|
||||||
if (td->flag & TD_SELECTED) {
|
if (td->flag & TD_SELECTED) {
|
||||||
@@ -1371,7 +1374,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Utility function for getting the handle data from bezier's */
|
/* Utility function for getting the handle data from bezier's */
|
||||||
static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) {
|
static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt)
|
||||||
|
{
|
||||||
TransDataCurveHandleFlags *hdata;
|
TransDataCurveHandleFlags *hdata;
|
||||||
td->flag |= TD_BEZTRIPLE;
|
td->flag |= TD_BEZTRIPLE;
|
||||||
hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
||||||
|
@@ -127,7 +127,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) {
|
TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite)
|
||||||
|
{
|
||||||
Base *base = CTX_data_active_base(C);
|
Base *base = CTX_data_active_base(C);
|
||||||
Object *ob;
|
Object *ob;
|
||||||
float mat[3][3];
|
float mat[3][3];
|
||||||
@@ -150,7 +151,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports)
|
|||||||
return addMatrixSpace(C, mat, name, overwrite);
|
return addMatrixSpace(C, mat, name, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) {
|
TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite)
|
||||||
|
{
|
||||||
float mat[3][3];
|
float mat[3][3];
|
||||||
float normal[3], plane[3];
|
float normal[3], plane[3];
|
||||||
|
|
||||||
@@ -169,7 +171,8 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na
|
|||||||
return addMatrixSpace(C, mat, name, overwrite);
|
return addMatrixSpace(C, mat, name, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) {
|
TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite)
|
||||||
|
{
|
||||||
float mat[3][3];
|
float mat[3][3];
|
||||||
float normal[3], plane[3];
|
float normal[3], plane[3];
|
||||||
int type;
|
int type;
|
||||||
@@ -267,7 +270,8 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) {
|
TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite)
|
||||||
|
{
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
TransformOrientation *ts = NULL;
|
TransformOrientation *ts = NULL;
|
||||||
|
|
||||||
@@ -294,7 +298,8 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[],
|
|||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) {
|
void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
|
||||||
|
{
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
TransformOrientation *ts;
|
TransformOrientation *ts;
|
||||||
int i;
|
int i;
|
||||||
@@ -321,7 +326,8 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIF_removeTransformOrientationIndex(bContext *C, int index) {
|
void BIF_removeTransformOrientationIndex(bContext *C, int index)
|
||||||
|
{
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
TransformOrientation *ts= BLI_findlink(transform_spaces, index);
|
TransformOrientation *ts= BLI_findlink(transform_spaces, index);
|
||||||
|
|
||||||
@@ -344,7 +350,8 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) {
|
void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
|
||||||
|
{
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
View3D *v3d = CTX_wm_view3d(C);
|
View3D *v3d = CTX_wm_view3d(C);
|
||||||
TransformOrientation *ts;
|
TransformOrientation *ts;
|
||||||
@@ -358,7 +365,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIF_selectTransformOrientationValue(bContext *C, int orientation) {
|
void BIF_selectTransformOrientationValue(bContext *C, int orientation)
|
||||||
|
{
|
||||||
View3D *v3d = CTX_wm_view3d(C);
|
View3D *v3d = CTX_wm_view3d(C);
|
||||||
if(v3d) /* currently using generic poll */
|
if(v3d) /* currently using generic poll */
|
||||||
v3d->twmode = orientation;
|
v3d->twmode = orientation;
|
||||||
@@ -407,7 +415,8 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) {
|
const char * BIF_menustringTransformOrientation(const bContext *C, const char *title)
|
||||||
|
{
|
||||||
const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3");
|
const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3");
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
TransformOrientation *ts;
|
TransformOrientation *ts;
|
||||||
@@ -429,7 +438,8 @@ const char * BIF_menustringTransformOrientation(const bContext *C, const char *t
|
|||||||
return str_menu;
|
return str_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BIF_countTransformOrientation(const bContext *C) {
|
int BIF_countTransformOrientation(const bContext *C)
|
||||||
|
{
|
||||||
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
|
||||||
TransformOrientation *ts;
|
TransformOrientation *ts;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -441,7 +451,8 @@ int BIF_countTransformOrientation(const bContext *C) {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) {
|
void applyTransformOrientation(const bContext *C, float mat[3][3], char *name)
|
||||||
|
{
|
||||||
TransformOrientation *ts;
|
TransformOrientation *ts;
|
||||||
View3D *v3d = CTX_wm_view3d(C);
|
View3D *v3d = CTX_wm_view3d(C);
|
||||||
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
|
||||||
|
@@ -647,11 +647,13 @@ static char *code_generate_vertex(ListBase *nodes)
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPU_bicubic_bump_support(void){
|
int GPU_bicubic_bump_support(void)
|
||||||
|
{
|
||||||
return GLEW_ARB_texture_gather && GLEW_ARB_texture_query_lod && GLEW_VERSION_3_0;
|
return GLEW_ARB_texture_gather && GLEW_ARB_texture_query_lod && GLEW_VERSION_3_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_code_generate_glsl_lib(void){
|
void GPU_code_generate_glsl_lib(void)
|
||||||
|
{
|
||||||
DynStr *ds;
|
DynStr *ds;
|
||||||
|
|
||||||
/* only initialize the library once */
|
/* only initialize the library once */
|
||||||
|
@@ -110,7 +110,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ismovie(const char *UNUSED(filepath)) {
|
int ismovie(const char *UNUSED(filepath))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,8 @@ static void free_anim_movie(struct anim *UNUSED(anim)) { ; }
|
|||||||
# define PATHSEPERATOR '/'
|
# define PATHSEPERATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) {
|
static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen)
|
||||||
|
{
|
||||||
unsigned short len,nume,nums=0;
|
unsigned short len,nume,nums=0;
|
||||||
short i,found=FALSE;
|
short i,found=FALSE;
|
||||||
|
|
||||||
@@ -161,11 +163,13 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) {
|
static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic)
|
||||||
|
{
|
||||||
BLI_stringenc(string, head, tail, numlen, pic);
|
BLI_stringenc(string, head, tail, numlen, pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_anim_avi (struct anim *anim) {
|
static void free_anim_avi (struct anim *anim)
|
||||||
|
{
|
||||||
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
@@ -206,7 +210,8 @@ static void free_anim_ffmpeg(struct anim * anim);
|
|||||||
static void free_anim_redcode(struct anim * anim);
|
static void free_anim_redcode(struct anim * anim);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void IMB_free_anim(struct anim * anim) {
|
void IMB_free_anim(struct anim * anim)
|
||||||
|
{
|
||||||
if (anim == NULL) {
|
if (anim == NULL) {
|
||||||
printf("free anim, anim == NULL\n");
|
printf("free anim, anim == NULL\n");
|
||||||
return;
|
return;
|
||||||
@@ -229,14 +234,16 @@ void IMB_free_anim(struct anim * anim) {
|
|||||||
MEM_freeN(anim);
|
MEM_freeN(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMB_close_anim(struct anim * anim) {
|
void IMB_close_anim(struct anim * anim)
|
||||||
|
{
|
||||||
if (anim == NULL) return;
|
if (anim == NULL) return;
|
||||||
|
|
||||||
IMB_free_anim(anim);
|
IMB_free_anim(anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) {
|
struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex)
|
||||||
|
{
|
||||||
struct anim * anim;
|
struct anim * anim;
|
||||||
|
|
||||||
anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct");
|
anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct");
|
||||||
@@ -249,7 +256,8 @@ struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int startavi (struct anim *anim) {
|
static int startavi (struct anim *anim)
|
||||||
|
{
|
||||||
|
|
||||||
AviError avierror;
|
AviError avierror;
|
||||||
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
#if defined(_WIN32) && !defined(FREE_WINDOWS)
|
||||||
@@ -355,7 +363,8 @@ static int startavi (struct anim *anim) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
|
static ImBuf * avi_fetchibuf (struct anim *anim, int position)
|
||||||
|
{
|
||||||
ImBuf *ibuf = NULL;
|
ImBuf *ibuf = NULL;
|
||||||
int *tmp;
|
int *tmp;
|
||||||
int y;
|
int y;
|
||||||
@@ -405,7 +414,8 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
|
|||||||
|
|
||||||
extern void do_init_ffmpeg(void);
|
extern void do_init_ffmpeg(void);
|
||||||
|
|
||||||
static int startffmpeg(struct anim * anim) {
|
static int startffmpeg(struct anim * anim)
|
||||||
|
{
|
||||||
int i, videoStream;
|
int i, videoStream;
|
||||||
|
|
||||||
AVCodec *pCodec;
|
AVCodec *pCodec;
|
||||||
@@ -1032,7 +1042,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
|
|||||||
return anim->last_frame;
|
return anim->last_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_anim_ffmpeg(struct anim * anim) {
|
static void free_anim_ffmpeg(struct anim * anim)
|
||||||
|
{
|
||||||
if (anim == NULL) return;
|
if (anim == NULL) return;
|
||||||
|
|
||||||
if (anim->pCodecCtx) {
|
if (anim->pCodecCtx) {
|
||||||
@@ -1058,7 +1069,8 @@ static void free_anim_ffmpeg(struct anim * anim) {
|
|||||||
|
|
||||||
#ifdef WITH_REDCODE
|
#ifdef WITH_REDCODE
|
||||||
|
|
||||||
static int startredcode(struct anim * anim) {
|
static int startredcode(struct anim * anim)
|
||||||
|
{
|
||||||
anim->redcodeCtx = redcode_open(anim->name);
|
anim->redcodeCtx = redcode_open(anim->name);
|
||||||
if (!anim->redcodeCtx) {
|
if (!anim->redcodeCtx) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1068,7 +1080,8 @@ static int startredcode(struct anim * anim) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImBuf * redcode_fetchibuf(struct anim * anim, int position) {
|
static ImBuf * redcode_fetchibuf(struct anim * anim, int position)
|
||||||
|
{
|
||||||
struct ImBuf * ibuf;
|
struct ImBuf * ibuf;
|
||||||
struct redcode_frame * frame;
|
struct redcode_frame * frame;
|
||||||
struct redcode_frame_raw * raw_frame;
|
struct redcode_frame_raw * raw_frame;
|
||||||
@@ -1099,7 +1112,8 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) {
|
|||||||
return ibuf;
|
return ibuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_anim_redcode(struct anim * anim) {
|
static void free_anim_redcode(struct anim * anim)
|
||||||
|
{
|
||||||
if (anim->redcodeCtx) {
|
if (anim->redcodeCtx) {
|
||||||
redcode_close(anim->redcodeCtx);
|
redcode_close(anim->redcodeCtx);
|
||||||
anim->redcodeCtx = 0;
|
anim->redcodeCtx = 0;
|
||||||
@@ -1113,7 +1127,8 @@ static void free_anim_redcode(struct anim * anim) {
|
|||||||
/* Geen plaatje, probeer dan volgende animatie te openen */
|
/* Geen plaatje, probeer dan volgende animatie te openen */
|
||||||
/* gelukt, haal dan eerste plaatje van animatie */
|
/* gelukt, haal dan eerste plaatje van animatie */
|
||||||
|
|
||||||
static struct ImBuf * anim_getnew(struct anim * anim) {
|
static struct ImBuf * anim_getnew(struct anim * anim)
|
||||||
|
{
|
||||||
struct ImBuf *ibuf = NULL;
|
struct ImBuf *ibuf = NULL;
|
||||||
|
|
||||||
if (anim == NULL) return(NULL);
|
if (anim == NULL) return(NULL);
|
||||||
@@ -1175,7 +1190,8 @@ static struct ImBuf * anim_getnew(struct anim * anim) {
|
|||||||
return(ibuf);
|
return(ibuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ImBuf * IMB_anim_previewframe(struct anim * anim) {
|
struct ImBuf * IMB_anim_previewframe(struct anim * anim)
|
||||||
|
{
|
||||||
struct ImBuf * ibuf = NULL;
|
struct ImBuf * ibuf = NULL;
|
||||||
int position = 0;
|
int position = 0;
|
||||||
|
|
||||||
@@ -1282,7 +1298,8 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position,
|
|||||||
|
|
||||||
/***/
|
/***/
|
||||||
|
|
||||||
int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) {
|
int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc)
|
||||||
|
{
|
||||||
struct anim_index * idx;
|
struct anim_index * idx;
|
||||||
if (tc == IMB_TC_NONE) {
|
if (tc == IMB_TC_NONE) {
|
||||||
return anim->duration;
|
return anim->duration;
|
||||||
|
@@ -185,14 +185,16 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Couple of helper functions for writing our data */
|
/* Couple of helper functions for writing our data */
|
||||||
static int putIntLSB(unsigned int ui,FILE *ofile) {
|
static int putIntLSB(unsigned int ui,FILE *ofile)
|
||||||
|
{
|
||||||
putc((ui>>0)&0xFF,ofile);
|
putc((ui>>0)&0xFF,ofile);
|
||||||
putc((ui>>8)&0xFF,ofile);
|
putc((ui>>8)&0xFF,ofile);
|
||||||
putc((ui>>16)&0xFF,ofile);
|
putc((ui>>16)&0xFF,ofile);
|
||||||
return putc((ui>>24)&0xFF,ofile);
|
return putc((ui>>24)&0xFF,ofile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int putShortLSB(unsigned short us,FILE *ofile) {
|
static int putShortLSB(unsigned short us,FILE *ofile)
|
||||||
|
{
|
||||||
putc((us>>0)&0xFF,ofile);
|
putc((us>>0)&0xFF,ofile);
|
||||||
return putc((us>>8)&0xFF,ofile);
|
return putc((us>>8)&0xFF,ofile);
|
||||||
}
|
}
|
||||||
|
@@ -70,21 +70,24 @@ int imb_is_a_jp2(unsigned char *buf)
|
|||||||
/**
|
/**
|
||||||
sample error callback expecting a FILE* client object
|
sample error callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
static void error_callback(const char *msg, void *client_data) {
|
static void error_callback(const char *msg, void *client_data)
|
||||||
|
{
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[ERROR] %s", msg);
|
fprintf(stream, "[ERROR] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample warning callback expecting a FILE* client object
|
sample warning callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
static void warning_callback(const char *msg, void *client_data) {
|
static void warning_callback(const char *msg, void *client_data)
|
||||||
|
{
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[WARNING] %s", msg);
|
fprintf(stream, "[WARNING] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample debug callback expecting no client object
|
sample debug callback expecting no client object
|
||||||
*/
|
*/
|
||||||
static void info_callback(const char *msg, void *client_data) {
|
static void info_callback(const char *msg, void *client_data)
|
||||||
|
{
|
||||||
(void)client_data;
|
(void)client_data;
|
||||||
fprintf(stdout, "[INFO] %s", msg);
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
}
|
}
|
||||||
@@ -305,7 +308,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
|
|||||||
#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/
|
#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/
|
||||||
|
|
||||||
|
|
||||||
static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
static int initialise_4K_poc(opj_poc_t *POC, int numres)
|
||||||
|
{
|
||||||
POC[0].tile = 1;
|
POC[0].tile = 1;
|
||||||
POC[0].resno0 = 0;
|
POC[0].resno0 = 0;
|
||||||
POC[0].compno0 = 0;
|
POC[0].compno0 = 0;
|
||||||
@@ -323,7 +327,8 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cinema_parameters(opj_cparameters_t *parameters){
|
static void cinema_parameters(opj_cparameters_t *parameters)
|
||||||
|
{
|
||||||
parameters->tile_size_on = false;
|
parameters->tile_size_on = false;
|
||||||
parameters->cp_tdx=1;
|
parameters->cp_tdx=1;
|
||||||
parameters->cp_tdy=1;
|
parameters->cp_tdy=1;
|
||||||
@@ -356,7 +361,8 @@ static void cinema_parameters(opj_cparameters_t *parameters){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
float temp_rate;
|
float temp_rate;
|
||||||
|
|
||||||
@@ -442,8 +448,8 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
|
static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
|
||||||
|
{
|
||||||
unsigned char *rect;
|
unsigned char *rect;
|
||||||
float *rect_float;
|
float *rect_float;
|
||||||
|
|
||||||
@@ -662,8 +668,8 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
|
|||||||
|
|
||||||
|
|
||||||
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
|
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
|
||||||
int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) {
|
int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
|
||||||
|
{
|
||||||
int quality = ibuf->ftype & 0xff;
|
int quality = ibuf->ftype & 0xff;
|
||||||
|
|
||||||
int bSuccess;
|
int bSuccess;
|
||||||
|
@@ -199,12 +199,14 @@ int IMB_ispic(const char *filename)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int isavi (const char *name) {
|
static int isavi (const char *name)
|
||||||
|
{
|
||||||
return AVI_is_avi (name);
|
return AVI_is_avi (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_QUICKTIME
|
#ifdef WITH_QUICKTIME
|
||||||
static int isqtime (const char *name) {
|
static int isqtime (const char *name)
|
||||||
|
{
|
||||||
return anim_is_quicktime (name);
|
return anim_is_quicktime (name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -240,7 +242,8 @@ void do_init_ffmpeg(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isffmpeg (const char *filename) {
|
static int isffmpeg (const char *filename)
|
||||||
|
{
|
||||||
AVFormatContext *pFormatCtx;
|
AVFormatContext *pFormatCtx;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int videoStream;
|
int videoStream;
|
||||||
@@ -323,7 +326,8 @@ static int isredcode(const char * filename)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int imb_get_anim_type(const char * name) {
|
int imb_get_anim_type(const char * name)
|
||||||
|
{
|
||||||
int type;
|
int type;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@@ -364,7 +368,8 @@ int imb_get_anim_type(const char * name) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int IMB_isanim(const char *filename) {
|
int IMB_isanim(const char *filename)
|
||||||
|
{
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
if(U.uiflag & USER_FILTERFILEEXTS) {
|
if(U.uiflag & USER_FILTERFILEEXTS) {
|
||||||
|
@@ -805,7 +805,8 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
|
|||||||
PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
|
PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
|
||||||
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
|
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
|
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, \n"
|
||||||
|
" only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg pt: Point\n"
|
" :arg pt: Point\n"
|
||||||
" :type pt: :class:`mathutils.Vector`\n"
|
" :type pt: :class:`mathutils.Vector`\n"
|
||||||
|
@@ -1950,7 +1950,15 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
|
|||||||
initVideoTexture();
|
initVideoTexture();
|
||||||
|
|
||||||
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
|
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
|
||||||
PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes'), 'texture':__import__('VideoTexture')});");
|
PyRun_SimpleString("sys = __import__('sys');"
|
||||||
|
"mod = sys.modules['bge'] = type(sys)('bge');"
|
||||||
|
"mod.__dict__.update({'logic':__import__('GameLogic'), "
|
||||||
|
"'render':__import__('Rasterizer'), "
|
||||||
|
"'events':__import__('GameKeys'), "
|
||||||
|
"'constraints':__import__('PhysicsConstraints'), "
|
||||||
|
"'types':__import__('GameTypes'), "
|
||||||
|
"'texture':__import__('VideoTexture')});"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyModuleDef Rasterizer_module_def = {
|
static struct PyModuleDef Rasterizer_module_def = {
|
||||||
|
Reference in New Issue
Block a user