Merge branch 'release/1.9.x'
This commit is contained in:
commit
2515ea5dff
|
|
@ -2466,7 +2466,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||
def saveCubeMap(self, namePrefix = 'cube_map_#.png',
|
||||
defaultFilename = 0, source = None,
|
||||
camera = None, size = 128,
|
||||
cameraMask = PandaNode.getAllCameraMask()):
|
||||
cameraMask = PandaNode.getAllCameraMask(),
|
||||
sourceLens = None):
|
||||
|
||||
"""
|
||||
Similar to screenshot(), this sets up a temporary cube map
|
||||
|
|
@ -2494,6 +2495,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||
if camera == None:
|
||||
camera = base.camera
|
||||
|
||||
if sourceLens == None:
|
||||
sourceLens = base.camLens
|
||||
|
||||
if hasattr(source, "getWindow"):
|
||||
source = source.getWindow()
|
||||
|
||||
|
|
@ -2504,7 +2508,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||
|
||||
# Set the near and far planes from the default lens.
|
||||
lens = rig.find('**/+Camera').node().getLens()
|
||||
lens.setNearFar(base.camLens.getNear(), base.camLens.getFar())
|
||||
|
||||
lens.setNearFar(sourceLens.getNear(), sourceLens.getFar())
|
||||
|
||||
# Now render a frame to fill up the texture.
|
||||
rig.reparentTo(camera)
|
||||
|
|
@ -2525,7 +2530,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||
defaultFilename = 0, source = None,
|
||||
camera = None, size = 256,
|
||||
cameraMask = PandaNode.getAllCameraMask(),
|
||||
numVertices = 1000):
|
||||
numVertices = 1000, sourceLens = None):
|
||||
"""
|
||||
This works much like saveCubeMap(), and uses the graphics
|
||||
API's hardware cube-mapping ability to get a 360-degree view
|
||||
|
|
@ -2550,6 +2555,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||
if camera == None:
|
||||
camera = base.camera
|
||||
|
||||
if sourceLens == None:
|
||||
sourceLens = base.camLens
|
||||
|
||||
if hasattr(source, "getWindow"):
|
||||
source = source.getWindow()
|
||||
|
||||
|
|
@ -2568,7 +2576,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||
|
||||
# Set the near and far planes from the default lens.
|
||||
lens = rig.find('**/+Camera').node().getLens()
|
||||
lens.setNearFar(base.camLens.getNear(), base.camLens.getFar())
|
||||
lens.setNearFar(sourceLens.getNear(), sourceLens.getFar())
|
||||
|
||||
# Set up the scene to convert the cube map. It's just a
|
||||
# simple scene, with only the FisheyeMaker object in it.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ CPPFile::
|
|||
CPPFile(const Filename &filename, const Filename &filename_as_referenced,
|
||||
Source source) :
|
||||
_filename(filename), _filename_as_referenced(filename_as_referenced),
|
||||
_source(source)
|
||||
_source(source),
|
||||
_pragma_once(false)
|
||||
{
|
||||
_filename.set_text();
|
||||
_filename_as_referenced.set_text();
|
||||
|
|
@ -42,7 +43,8 @@ CPPFile::
|
|||
CPPFile(const CPPFile ©) :
|
||||
_filename(copy._filename),
|
||||
_filename_as_referenced(copy._filename_as_referenced),
|
||||
_source(copy._source)
|
||||
_source(copy._source),
|
||||
_pragma_once(copy._pragma_once)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +58,7 @@ operator = (const CPPFile ©) {
|
|||
_filename = copy._filename;
|
||||
_filename_as_referenced = copy._filename_as_referenced;
|
||||
_source = copy._source;
|
||||
_pragma_once = copy._pragma_once;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
Filename _filename;
|
||||
Filename _filename_as_referenced;
|
||||
Source _source;
|
||||
mutable bool _pragma_once;
|
||||
};
|
||||
|
||||
inline ostream &operator << (ostream &out, const CPPFile &file) {
|
||||
|
|
|
|||
|
|
@ -620,6 +620,7 @@ push_file(const CPPFile &file) {
|
|||
indent(cerr, _files.size() * 2)
|
||||
<< "Reading " << file << "\n";
|
||||
}
|
||||
|
||||
_files.push_back(InputFile());
|
||||
InputFile &infile = _files.back();
|
||||
|
||||
|
|
@ -1158,7 +1159,7 @@ process_directive(int c) {
|
|||
} else if (command == "include") {
|
||||
handle_include_directive(args, first_line, first_col, first_file);
|
||||
} else if (command == "pragma") {
|
||||
// Quietly ignore pragmas.
|
||||
handle_pragma_directive(args, first_line, first_col, first_file);
|
||||
} else if (command == "ident") {
|
||||
// Quietly ignore idents.
|
||||
} else if (command == "error") {
|
||||
|
|
@ -1462,7 +1463,16 @@ handle_include_directive(const string &args, int first_line,
|
|||
first_line, first_col, first_file);
|
||||
} else {
|
||||
_last_c = '\0';
|
||||
if (!push_file(CPPFile(filename, filename_as_referenced, source))) {
|
||||
|
||||
CPPFile file(filename, filename_as_referenced, source);
|
||||
|
||||
// Don't include it if we included it before and it had #pragma once.
|
||||
ParsedFiles::const_iterator it = _parsed_files.find(file);
|
||||
if (it->_pragma_once) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!push_file(file)) {
|
||||
warning("Unable to read " + filename.get_fullpath(),
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
|
|
@ -1473,6 +1483,21 @@ handle_include_directive(const string &args, int first_line,
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CPPPreprocessor::handle_pragma_directive
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_pragma_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
if (args == "once") {
|
||||
ParsedFiles::iterator it = _parsed_files.find(first_file);
|
||||
assert(it != _parsed_files.end());
|
||||
it->_pragma_once = true;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CPPPreprocessor::handle_error_directive
|
||||
// Access: Private
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ private:
|
|||
int first_col, const CPPFile &first_file);
|
||||
void handle_include_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_pragma_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_error_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
|
||||
|
|
|
|||
|
|
@ -385,8 +385,11 @@ get_flatten_mode() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const NodePath GeoMipTerrain::
|
||||
get_block_node_path(unsigned short mx, unsigned short my) {
|
||||
nassertr(mx < _blocks.size(), NodePath::fail());
|
||||
nassertr(my < _blocks[mx].size(), NodePath::fail());
|
||||
return _blocks[mx][my];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeoMipTerrain::get_block_from_pos
|
||||
// Access: Published
|
||||
|
|
|
|||
Loading…
Reference in New Issue