mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
add texture-scale
This commit is contained in:
parent
fbd72a9000
commit
6aff5d74be
@ -74,6 +74,14 @@ ConfigVariableInt max_texture_dimension
|
||||
"loaded from a file) will be automatically scaled down, if "
|
||||
"necessary, so that neither dimension is larger than this value."));
|
||||
|
||||
ConfigVariableDouble texture_scale
|
||||
("texture-scale", 1.0,
|
||||
PRC_DESC("This is a global scale factor that is applied to each texture "
|
||||
"as it is loaded from disk. For instance, a value of 0.5 will "
|
||||
"reduce each texture to one-half its size in each dimension. This "
|
||||
"scale factor is applied before textures-power-2 or "
|
||||
"max-texture-dimension."));
|
||||
|
||||
ConfigVariableBool keep_texture_ram
|
||||
("keep-texture-ram", false,
|
||||
PRC_DESC("Set this to true to retain the ram image for each texture after it "
|
||||
|
@ -38,6 +38,7 @@ EXPCL_PANDA istream &operator >> (istream &in, AutoTextureScale &ats);
|
||||
|
||||
// Configure variables for gobj package.
|
||||
extern EXPCL_PANDA ConfigVariableInt max_texture_dimension;
|
||||
extern EXPCL_PANDA ConfigVariableDouble texture_scale;
|
||||
extern EXPCL_PANDA ConfigVariableBool keep_texture_ram;
|
||||
extern EXPCL_PANDA ConfigVariableBool preload_textures;
|
||||
extern EXPCL_PANDA ConfigVariableBool compressed_textures;
|
||||
|
@ -1873,9 +1873,6 @@ unclean_set_num_rows(int n) {
|
||||
|
||||
bool any_changed = false;
|
||||
|
||||
int color_array = -1;
|
||||
int orig_color_rows = -1;
|
||||
|
||||
for (size_t i = 0; i < _cdata->_arrays.size(); i++) {
|
||||
if (_array_writers[i]->get_num_rows() != n) {
|
||||
// Copy-on-write.
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "bam.h"
|
||||
#include "zStream.h"
|
||||
#include "indent.h"
|
||||
#include "cmath.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@ -2816,6 +2817,9 @@ consider_rescale(PNMImage &pnmimage, const string &name) {
|
||||
int new_x_size = pnmimage.get_x_size();
|
||||
int new_y_size = pnmimage.get_y_size();
|
||||
|
||||
new_x_size = (int)cfloor(new_x_size * texture_scale + 0.5);
|
||||
new_y_size = (int)cfloor(new_y_size * texture_scale + 0.5);
|
||||
|
||||
switch (textures_power_2) {
|
||||
case ATS_down:
|
||||
new_x_size = down_to_power_2(new_x_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user