39 unsigned int aXSize,
unsigned int aYSize )
41 wxImage
image( aXSize, aYSize );
42 image.SetData( aRGBpixelBuffer );
44 image.SaveFile( aFileName + wxT(
".png" ), wxBITMAP_TYPE_PNG );
50 unsigned char* aAlphaBuffer,
unsigned int aXSize,
53 wxImage
image( aXSize, aYSize );
54 image.SetData( aRGBpixelBuffer );
55 image.SetAlpha( aAlphaBuffer );
57 image.SaveFile( aFileName + wxT(
".png" ), wxBITMAP_TYPE_PNG );
62void DBG_SaveBuffer(
const wxString& aFileName,
const unsigned char *aInBuffer,
63 unsigned int aXSize,
unsigned int aYSize )
65 const unsigned int wxh = aXSize * aYSize;
67 unsigned char *pixelbuffer = (
unsigned char*) malloc( wxh * 3 );
69 for(
unsigned int i = 0; i < wxh; ++i )
71 unsigned char v = aInBuffer[i];
74 pixelbuffer[i * 3 + 0] = v;
75 pixelbuffer[i * 3 + 1] = v;
76 pixelbuffer[i * 3 + 2] = v;
84 unsigned int aXSize,
unsigned int aYSize )
86 const unsigned int wxh = aXSize * aYSize;
88 unsigned char *pixelbuffer = (
unsigned char*) malloc( wxh * 3 );
90 for(
unsigned int i = 0; i < wxh; ++i )
92 const unsigned char v = (
unsigned char)glm::min( (
int)(aInBuffer[i] * 255.0f), 255 );
95 pixelbuffer[i * 3 + 0] = v;
96 pixelbuffer[i * 3 + 1] = v;
97 pixelbuffer[i * 3 + 2] = v;
105 unsigned int aXSize,
unsigned int aYSize )
107 const unsigned int wxh = aXSize * aYSize;
109 unsigned char *pixelbuffer = (
unsigned char*) malloc( wxh * 3 );
111 for(
unsigned int i = 0; i < wxh; ++i )
113 const SFVEC3F &v = aInBuffer[i];
114 const unsigned int ix3 = i * 3;
117 pixelbuffer[ix3 + 0] = (
unsigned char) glm::min( (
int) ( v.r * 255.0f ), 255 );
118 pixelbuffer[ix3 + 1] = (
unsigned char) glm::min( (
int) ( v.g * 255.0f ), 255 );
119 pixelbuffer[ix3 + 2] = (
unsigned char) glm::min( (
int) ( v.b * 255.0f ), 255 );
127 unsigned int aXSize,
unsigned int aYSize )
129 const unsigned int wxh = aXSize * aYSize;
131 unsigned char *pixelbuffer = (
unsigned char*) malloc( wxh * 4 );
132 unsigned char *alphabuffer = (
unsigned char*) malloc( wxh );
134 for(
unsigned int i = 0; i < wxh; ++i )
136 const SFVEC4F &v = aInBuffer[i];
137 const unsigned int ix3 = i * 3;
140 pixelbuffer[ix3 + 0] = (
unsigned char) glm::min( (
int) ( v.r * 255.0f ), 255 );
141 pixelbuffer[ix3 + 1] = (
unsigned char) glm::min( (
int) ( v.g * 255.0f ), 255 );
142 pixelbuffer[ix3 + 2] = (
unsigned char) glm::min( (
int) ( v.b * 255.0f ), 255 );
144 alphabuffer[i] = (
unsigned char) glm::min( (
int) ( v.a * 255.0f ), 255 );
152 unsigned int aXSize,
unsigned int aYSize )
154 const unsigned int wxh = aXSize * aYSize;
156 unsigned char *pixelbuffer = (
unsigned char*) malloc( wxh * 3 );
158 for(
unsigned int i = 0; i < wxh; ++i )
160 const SFVEC3F &v = aInNormalsBuffer[i];
161 const unsigned int ix3 = i * 3;
164 pixelbuffer[ix3 + 0] = (
unsigned char) glm::min( (
int) ( ( v.r + 1.0f ) * 127.0f ), 255 );
165 pixelbuffer[ix3 + 1] = (
unsigned char) glm::min( (
int) ( ( v.g + 1.0f ) * 127.0f ), 255 );
166 pixelbuffer[ix3 + 2] = (
unsigned char) glm::min( (
int) ( ( v.b + 1.0f ) * 127.0f ), 255 );
void DBG_SaveBuffer(const wxString &aFileName, const unsigned char *aInBuffer, unsigned int aXSize, unsigned int aYSize)
static void dbg_save_rgb_a_buffer(const wxString &aFileName, unsigned char *aRGBpixelBuffer, unsigned char *aAlphaBuffer, unsigned int aXSize, unsigned int aYSize)
static void dbg_save_rgb_buffer(const wxString &aFileName, unsigned char *aRGBpixelBuffer, unsigned int aXSize, unsigned int aYSize)
void DBG_SaveNormalsBuffer(const wxString &aFileName, const SFVEC3F *aInNormalsBuffer, unsigned int aXSize, unsigned int aYSize)