Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2020-12-24 15:31:52 +01:00
commit a3010a43a5
16 changed files with 381 additions and 24 deletions

View File

@ -213,7 +213,8 @@ class build_apps(setuptools.Command):
'dciman32.dll', 'comdlg32.dll', 'comctl32.dll', 'ole32.dll',
'oleaut32.dll', 'gdiplus.dll', 'winmm.dll', 'iphlpapi.dll',
'msvcrt.dll', 'kernelbase.dll', 'msimg32.dll', 'msacm32.dll',
'setupapi.dll', 'version.dll',
'setupapi.dll', 'version.dll', 'userenv.dll', 'netapi32.dll',
'crypt32.dll',
# manylinux1/linux
'libdl.so.*', 'libstdc++.so.*', 'libm.so.*', 'libgcc_s.so.*',
@ -229,6 +230,42 @@ class build_apps(setuptools.Command):
'/usr/lib/libSystem.*.dylib',
'/usr/lib/libbz2.*.dylib',
'/usr/lib/libedit.*.dylib',
'/usr/lib/libffi.dylib',
'/usr/lib/libauditd.0.dylib',
'/usr/lib/libgermantok.dylib',
'/usr/lib/liblangid.dylib',
'/usr/lib/libarchive.2.dylib',
'/usr/lib/libipsec.A.dylib',
'/usr/lib/libpanel.5.4.dylib',
'/usr/lib/libiodbc.2.1.18.dylib',
'/usr/lib/libhunspell-1.2.0.0.0.dylib',
'/usr/lib/libsqlite3.dylib',
'/usr/lib/libpam.1.dylib',
'/usr/lib/libtidy.A.dylib',
'/usr/lib/libDHCPServer.A.dylib',
'/usr/lib/libpam.2.dylib',
'/usr/lib/libXplugin.1.dylib',
'/usr/lib/libxslt.1.dylib',
'/usr/lib/libiodbcinst.2.1.18.dylib',
'/usr/lib/libBSDPClient.A.dylib',
'/usr/lib/libsandbox.1.dylib',
'/usr/lib/libform.5.4.dylib',
'/usr/lib/libbsm.0.dylib',
'/usr/lib/libMatch.1.dylib',
'/usr/lib/libresolv.9.dylib',
'/usr/lib/libcharset.1.dylib',
'/usr/lib/libxml2.2.dylib',
'/usr/lib/libiconv.2.dylib',
'/usr/lib/libScreenReader.dylib',
'/usr/lib/libdtrace.dylib',
'/usr/lib/libicucore.A.dylib',
'/usr/lib/libsasl2.2.dylib',
'/usr/lib/libpcap.A.dylib',
'/usr/lib/libexslt.0.dylib',
'/usr/lib/libcurl.4.dylib',
'/usr/lib/libncurses.5.4.dylib',
'/usr/lib/libxar.1.dylib',
'/usr/lib/libmenu.5.4.dylib',
'/System/Library/**',
]
@ -491,6 +528,7 @@ class build_apps(setuptools.Command):
path = sys.path[:]
p3dwhl = None
wheelpaths = []
if use_wheels:
wheelpaths = self.download_wheels(platform)
@ -769,6 +807,7 @@ class build_apps(setuptools.Command):
for module, source_path in freezer_extras:
if source_path is not None:
# Rename panda3d/core.pyd to panda3d.core.pyd
source_path = os.path.normpath(source_path)
basename = os.path.basename(source_path)
if '.' in module:
basename = module.rsplit('.', 1)[0] + '.' + basename
@ -778,6 +817,20 @@ class build_apps(setuptools.Command):
if len(parts) >= 3 and '-' in parts[-2]:
parts = parts[:-2] + parts[-1:]
basename = '.'.join(parts)
# Was this not found in a wheel? Then we may have a problem,
# since it may be for the current platform instead of the target
# platform.
if use_wheels:
found_in_wheel = False
for whl in wheelpaths:
whl = os.path.normpath(whl)
if source_path.lower().startswith(os.path.join(whl, '').lower()):
found_in_wheel = True
break
if not found_in_wheel:
self.warn('{} was not found in any downloaded wheel, is a dependency missing from requirements.txt?'.format(basename))
else:
# Builtin module, but might not be builtin in wheel libs, so double check
if module in whl_modules:
@ -881,6 +934,26 @@ class build_apps(setuptools.Command):
return check_pattern(fname, include_copy_list) and \
not check_pattern(fname, ignore_copy_list)
def skip_directory(src):
# Provides a quick-out for directory checks. NOT recursive.
fn = p3d.Filename.from_os_specific(os.path.normpath(src))
path = fn.get_fullpath()
fn.make_absolute()
abspath = fn.get_fullpath()
for pattern in ignore_copy_list:
if not pattern.pattern.endswith('/*') and \
not pattern.pattern.endswith('/**'):
continue
if abspath.startswith(pattern_dir + '/'):
return True
if path.startswith(pattern_dir + '/'):
return True
return False
def copy_file(src, dst):
src = os.path.normpath(src)
dst = os.path.normpath(dst)
@ -921,6 +994,10 @@ class build_apps(setuptools.Command):
rootdir = os.getcwd()
for dirname, subdirlist, filelist in os.walk(rootdir):
dirpath = os.path.relpath(dirname, rootdir)
if skip_directory(dirpath):
self.announce('skipping directory {}'.format(dirpath))
continue
for fname in filelist:
src = os.path.join(dirpath, fname)
dst = os.path.join(builddir, update_path(src))

View File

@ -16,6 +16,9 @@ Recommended maintenance release.
* Fix compilation error with Bullet 2.90+
* Assimp library was updated in Windows thirdparty packages (#1020)
* libCg is now shipped as library instead of framework on macOS (#1079)
* Add warnings to build_apps when forgetting dependencies in requirements.txt
* Add experimental TextureStage::M_emission mode
* Add experimental p3d_TextureNormal, p3d_TextureEmission, etc. GLSL inputs
* Fix ability to use deployment system when compiling without OpenSSL (#1073)
* Fix assorted issues with rgbPanel
* Fix comparison operator of RenderEffects object

View File

@ -261,6 +261,8 @@ ns_has_environment_variable(const string &var) const {
#ifndef PREREAD_ENVIRONMENT
return getenv(var.c_str()) != nullptr;
#else
return false;
#endif
}

View File

@ -381,6 +381,9 @@ def SetTarget(target, arch=None):
else:
arch = 'armv7a'
if arch == 'arm64':
arch = 'aarch64'
# Did we specify an API level?
global ANDROID_API
target, _, api = target.partition('-')

View File

@ -458,7 +458,7 @@ class WheelFile(object):
self.consider_add_dependency(target_dep, dep)
subprocess.call(["strip", "-s", temp.name])
subprocess.call(["patchelf", "--set-rpath", "$ORIGIN", temp.name])
subprocess.call(["patchelf", "--force-rpath", "--set-rpath", "$ORIGIN", temp.name])
source_path = temp.name

View File

@ -1911,6 +1911,10 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t)
PT(Texture) GraphicsStateGuardian::
fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
int &view) {
static PT(Texture) default_add_tex;
static PT(Texture) default_normal_height_tex;
switch (spec._part) {
case Shader::STO_named_input:
// Named texture input.
@ -2008,6 +2012,199 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
}
break;
case Shader::STO_ff_stage_i:
{
// We get the TextureAttrib directly from the _target_rs, not the
// filtered TextureAttrib in _target_texture.
const TextureAttrib *texattrib;
_target_rs->get_attrib_def(texattrib);
if (spec._stage < texattrib->get_num_on_ff_stages()) {
TextureStage *stage = texattrib->get_on_ff_stage(spec._stage);
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
break;
case Shader::STO_stage_modulate_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_modulate ||
mode == TextureStage::M_modulate_glow ||
mode == TextureStage::M_modulate_gloss) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
}
break;
case Shader::STO_stage_add_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_add) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
if (default_add_tex == nullptr) {
PT(Texture) tex = new Texture("default-add");
tex->setup_2d_texture(1, 1, Texture::T_unsigned_byte, Texture::F_luminance);
tex->set_clear_color(LColor(0, 0, 0, 1));
default_add_tex = std::move(tex);
}
return default_add_tex;
}
break;
case Shader::STO_stage_normal_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_normal ||
mode == TextureStage::M_normal_height) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
if (default_normal_height_tex == nullptr) {
PT(Texture) tex = new Texture("default-normal-height");
tex->setup_2d_texture(1, 1, Texture::T_unsigned_byte, Texture::F_rgba);
tex->set_clear_color(LColor(0.5, 0.5, 1, 0));
default_normal_height_tex = std::move(tex);
}
return default_normal_height_tex;
}
break;
case Shader::STO_stage_gloss_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_gloss ||
mode == TextureStage::M_modulate_gloss ||
mode == TextureStage::M_normal_gloss) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
}
break;
case Shader::STO_stage_height_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_height ||
mode == TextureStage::M_normal_height) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
if (default_normal_height_tex == nullptr) {
PT(Texture) tex = new Texture("default-normal-height");
tex->setup_2d_texture(1, 1, Texture::T_unsigned_byte, Texture::F_rgba);
tex->set_clear_color(LColor(0.5, 0.5, 1, 0));
default_normal_height_tex = std::move(tex);
}
return default_normal_height_tex;
}
break;
case Shader::STO_stage_selector_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_selector) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
}
break;
case Shader::STO_stage_emission_i:
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
if (mode == TextureStage::M_emission) {
if (si++ == spec._stage) {
sampler = texattrib->get_on_sampler(stage);
view += stage->get_tex_view_offset();
return texattrib->get_on_texture(stage);
}
}
}
}
}
break;
default:
nassertr(false, nullptr);
break;

View File

@ -558,6 +558,7 @@ affects_polygon_alpha() const {
case ET_gloss:
case ET_height:
case ET_normal_gloss:
case ET_emission:
return false;
case ET_selector:
@ -882,6 +883,9 @@ string_env_type(const string &string) {
} else if (cmp_nocase_uh(string, "normal_gloss") == 0) {
return ET_normal_gloss;
} else if (cmp_nocase_uh(string, "emission") == 0) {
return ET_emission;
} else {
return ET_unspecified;
}
@ -1312,6 +1316,9 @@ ostream &operator << (ostream &out, EggTexture::EnvType type) {
case EggTexture::ET_normal_gloss:
return out << "normal_gloss";
case EggTexture::ET_emission:
return out << "emission";
}
nassertr(false, out);

View File

@ -107,6 +107,7 @@ PUBLISHED:
ET_height,
ET_selector,
ET_normal_gloss,
ET_emission,
};
enum CombineMode {
CM_unspecified,

View File

@ -1540,6 +1540,10 @@ make_texture_stage(const EggTexture *egg_tex) {
stage->set_mode(TextureStage::M_normal_gloss);
break;
case EggTexture::ET_emission:
stage->set_mode(TextureStage::M_emission);
break;
case EggTexture::ET_unspecified:
break;
}

View File

@ -855,6 +855,9 @@ convert_primitive(const GeomVertexData *vertex_data,
case TextureStage::M_normal_gloss:
egg_tex->set_env_type(EggTexture::ET_normal_gloss);
break;
case TextureStage::M_emission:
egg_tex->set_env_type(EggTexture::ET_emission);
break;
default:
break;
}

View File

@ -963,27 +963,65 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
_shader->cp_add_mat_spec(bind);
return;
}
if (size > 7 && noprefix.substr(0, 7) == "Texture") {
if (noprefix.compare(0, 7, "Texture") == 0) {
Shader::ShaderTexSpec bind;
bind._id = arg_id;
bind._part = Shader::STO_stage_i;
bind._name = 0;
string tail;
bind._stage = string_to_int(noprefix.substr(7), tail);
if (!tail.empty()) {
if (!get_sampler_texture_type(bind._desired_type, param_type)) {
GLCAT.error()
<< "Error parsing shader input name: unexpected '"
<< tail << "' in '" << param_name << "'\n";
<< "Could not bind texture input " << param_name << "\n";
return;
}
if (get_sampler_texture_type(bind._desired_type, param_type)) {
if (size > 7 && isdigit(noprefix[7])) {
// p3d_Texture0, p3d_Texture1, etc.
bind._part = Shader::STO_stage_i;
string tail;
bind._stage = string_to_int(noprefix.substr(7), tail);
if (!tail.empty()) {
GLCAT.error()
<< "Error parsing shader input name: unexpected '"
<< tail << "' in '" << param_name << "'\n";
return;
}
_glgsg->_glUniform1i(p, _shader->_tex_spec.size());
_shader->_tex_spec.push_back(bind);
} else {
GLCAT.error()
<< "Could not bind texture input " << param_name << "\n";
}
else {
// p3d_Texture[] or p3d_TextureModulate[], etc.
if (size == 7) {
bind._part = Shader::STO_stage_i;
}
else if (noprefix.compare(7, string::npos, "FF") == 0) {
bind._part = Shader::STO_ff_stage_i;
}
else if (noprefix.compare(7, string::npos, "Modulate") == 0) {
bind._part = Shader::STO_stage_modulate_i;
}
else if (noprefix.compare(7, string::npos, "Add") == 0) {
bind._part = Shader::STO_stage_add_i;
}
else if (noprefix.compare(7, string::npos, "Normal") == 0) {
bind._part = Shader::STO_stage_normal_i;
}
else if (noprefix.compare(7, string::npos, "Height") == 0) {
bind._part = Shader::STO_stage_height_i;
}
else if (noprefix.compare(7, string::npos, "Selector") == 0) {
bind._part = Shader::STO_stage_selector_i;
}
else if (noprefix.compare(7, string::npos, "Gloss") == 0) {
bind._part = Shader::STO_stage_gloss_i;
}
else if (noprefix.compare(7, string::npos, "Emission") == 0) {
bind._part = Shader::STO_stage_emission_i;
}
for (bind._stage = 0; bind._stage < param_size; ++bind._stage) {
_glgsg->_glUniform1i(p + bind._stage, _shader->_tex_spec.size());
_shader->_tex_spec.push_back(bind);
}
}
return;
}

View File

@ -227,6 +227,15 @@ public:
STO_stage_i,
STO_light_i_shadow_map,
STO_ff_stage_i,
STO_stage_modulate_i,
STO_stage_add_i,
STO_stage_normal_i,
STO_stage_height_i,
STO_stage_selector_i,
STO_stage_gloss_i,
STO_stage_emission_i,
};
enum ShaderArgClass {

View File

@ -517,6 +517,9 @@ operator << (ostream &out, TextureStage::Mode mode) {
case TextureStage::M_normal_gloss:
return out << "normal_gloss";
case TextureStage::M_emission:
return out << "emission";
}
return out << "**invalid Mode(" << (int)mode << ")**";

View File

@ -63,6 +63,8 @@ PUBLISHED:
M_height, // Rarely used: normal_height is more efficient.
M_selector,
M_normal_gloss,
M_emission,
};
enum CombineMode {

View File

@ -467,6 +467,9 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
skip = true;
}
break;
case TextureStage::M_emission:
info._flags = ShaderKey::TF_map_emission;
break;
default:
break;
}
@ -743,6 +746,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
int map_index_glow = -1;
int map_index_gloss = -1;
int map_index_emission = -1;
// Figure out whether we need to calculate any of these variables.
bool need_world_position = (key._num_clip_planes > 0);
@ -833,6 +837,9 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
if (tex._flags & ShaderKey::TF_map_gloss) {
map_index_gloss = i;
}
if (tex._flags & ShaderKey::TF_map_emission) {
map_index_emission = i;
}
}
if (need_tangents) {
tangent_freg = alloc_freg();
@ -1446,17 +1453,17 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
}
text << "\t // Begin view-space light summation\n";
if (key._material_flags & Material::F_emission) {
if (key._texture_flags & ShaderKey::TF_map_glow) {
text << "\t result = attr_material[2] * saturate(2 * (tex" << map_index_glow << ".a - 0.5));\n";
} else {
text << "\t result = attr_material[2];\n";
}
text << "\t result = attr_material[2];\n";
} else if (key._texture_flags & (ShaderKey::TF_map_glow | ShaderKey::TF_map_emission)) {
text << "\t result = float4(1,1,1,0);\n";
} else {
if (key._texture_flags & ShaderKey::TF_map_glow) {
text << "\t result = saturate(2 * (tex" << map_index_glow << ".a - 0.5));\n";
} else {
text << "\t result = float4(0,0,0,0);\n";
}
text << "\t result = float4(0,0,0,0);\n";
}
if (key._texture_flags & ShaderKey::TF_map_emission) {
text << "\t result.rgb *= tex" << map_index_emission << ".rgb;\n";
}
if (key._texture_flags & ShaderKey::TF_map_glow) {
text << "\t result *= saturate(2 * (tex" << map_index_glow << ".a - 0.5));\n";
}
if (key._have_separate_ambient) {
if (key._material_flags & Material::F_ambient) {

View File

@ -106,6 +106,7 @@ protected:
TF_map_height = 0x040,
TF_map_glow = 0x080,
TF_map_gloss = 0x100,
TF_map_emission = 0x001000000,
TF_uses_color = 0x200,
TF_uses_primary_color = 0x400,
TF_uses_last_saved_result = 0x800,