mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Added get_load_error function. Needed to know if the file was properly loaded or not before using a shader.
This commit is contained in:
parent
bcb1ff0418
commit
ffbde58774
@ -57,6 +57,16 @@ get_loaded() const {
|
|||||||
return _loaded;
|
return _loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Shader::get_load_error
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Shader::
|
||||||
|
get_load_error() const {
|
||||||
|
return _load_error;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Shader::get_preprocessor
|
// Function: Shader::get_preprocessor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -30,6 +30,7 @@ Shader::MakeTable Shader::_make_table;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
Shader::
|
Shader::
|
||||||
Shader() {
|
Shader() {
|
||||||
|
this -> _load_error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -80,6 +81,7 @@ load(const Filename &file, int preprocessor) {
|
|||||||
if (!vfs->read_file(file, result->_body, true)) {
|
if (!vfs->read_file(file, result->_body, true)) {
|
||||||
cerr << "Could not read shader file: " << file << "\n";
|
cerr << "Could not read shader file: " << file << "\n";
|
||||||
result->_body = "";
|
result->_body = "";
|
||||||
|
result->_load_error = true;
|
||||||
}
|
}
|
||||||
_load_table[key] = result;
|
_load_table[key] = result;
|
||||||
return result;
|
return result;
|
||||||
|
@ -42,6 +42,7 @@ PUBLISHED:
|
|||||||
INLINE const string &get_body() const;
|
INLINE const string &get_body() const;
|
||||||
INLINE int get_preprocessor() const;
|
INLINE int get_preprocessor() const;
|
||||||
INLINE bool get_loaded() const;
|
INLINE bool get_loaded() const;
|
||||||
|
INLINE bool get_load_error() const;
|
||||||
|
|
||||||
PT(ShaderExpansion) macroexpand(const RenderState *context) const;
|
PT(ShaderExpansion) macroexpand(const RenderState *context) const;
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ private:
|
|||||||
Filename _file;
|
Filename _file;
|
||||||
string _body;
|
string _body;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
|
bool _load_error;
|
||||||
int _preprocessor;
|
int _preprocessor;
|
||||||
|
|
||||||
PT(ShaderExpansion) _fixed_expansion;
|
PT(ShaderExpansion) _fixed_expansion;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user