mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
*** empty log message ***
This commit is contained in:
parent
30222dd3e9
commit
b7bbc1a250
@ -1067,7 +1067,7 @@ int framework_main(int argc, char *argv[]) {
|
|||||||
RenderRelation *arc = new RenderRelation(root, geomnode, 10);
|
RenderRelation *arc = new RenderRelation(root, geomnode, 10);
|
||||||
first_arc = arc;
|
first_arc = arc;
|
||||||
|
|
||||||
Texture *tex = TexturePool::load_texture("rock-floor.jpg");
|
Texture *tex = TexturePool::load_texture("rock-floor.rgb");
|
||||||
if (tex != (Texture *)NULL) {
|
if (tex != (Texture *)NULL) {
|
||||||
tex->set_minfilter(Texture::FT_linear);
|
tex->set_minfilter(Texture::FT_linear);
|
||||||
tex->set_magfilter(Texture::FT_linear);
|
tex->set_magfilter(Texture::FT_linear);
|
||||||
|
@ -56,6 +56,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) :
|
|||||||
_num_channels = _cinfo.output_components;
|
_num_channels = _cinfo.output_components;
|
||||||
_x_size = (int)_cinfo.output_width;
|
_x_size = (int)_cinfo.output_width;
|
||||||
_y_size = (int)_cinfo.output_height;
|
_y_size = (int)_cinfo.output_height;
|
||||||
|
_maxval = MAXJSAMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ read_data(xel *array, xelval *) {
|
|||||||
/* Here we use the library's state variable cinfo.output_scanline as the
|
/* Here we use the library's state variable cinfo.output_scanline as the
|
||||||
* loop counter, so that we don't have to keep track ourselves.
|
* loop counter, so that we don't have to keep track ourselves.
|
||||||
*/
|
*/
|
||||||
|
int x = 0;
|
||||||
while (_cinfo.output_scanline < _cinfo.output_height) {
|
while (_cinfo.output_scanline < _cinfo.output_height) {
|
||||||
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
||||||
* Here the array is only one element long, but you could ask for
|
* Here the array is only one element long, but you could ask for
|
||||||
@ -106,19 +108,21 @@ read_data(xel *array, xelval *) {
|
|||||||
jpeg_read_scanlines(&_cinfo, buffer, 1);
|
jpeg_read_scanlines(&_cinfo, buffer, 1);
|
||||||
/* Assume put_scanline_someplace wants a pointer and sample count. */
|
/* Assume put_scanline_someplace wants a pointer and sample count. */
|
||||||
//put_scanline_someplace(buffer[0], row_stride);
|
//put_scanline_someplace(buffer[0], row_stride);
|
||||||
uchar *bufptr = buffer[0];
|
JSAMPROW bufptr = buffer[0];
|
||||||
int x = 0;
|
for (int i = 0; i < row_stride; i += _cinfo.output_components) {
|
||||||
for (int i = 0; i < _cinfo.output_width; i += _cinfo.output_components) {
|
|
||||||
if (_cinfo.output_components == 1) {
|
if (_cinfo.output_components == 1) {
|
||||||
xelval val = bufptr[i];
|
xelval val = (xelval)bufptr[i];
|
||||||
PNM_ASSIGN1(array[x++], val);
|
nassertr(x < _x_size * _y_size, 0);
|
||||||
|
PNM_ASSIGN1(array[x], val);
|
||||||
} else {
|
} else {
|
||||||
xelval red, grn, blu;
|
xelval red, grn, blu;
|
||||||
red = (uchar)bufptr[i];
|
red = (xelval)bufptr[i];
|
||||||
grn = (uchar)bufptr[i+1];
|
grn = (xelval)bufptr[i+1];
|
||||||
blu = (uchar)bufptr[i+2];
|
blu = (xelval)bufptr[i+2];
|
||||||
PPM_ASSIGN(array[x++], red, grn, blu);
|
nassertr(x < _x_size * _y_size, 0);
|
||||||
|
PPM_ASSIGN(array[x], red, grn, blu);
|
||||||
}
|
}
|
||||||
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user