untabify
This commit is contained in:
parent
f9a3770230
commit
0cf03bc158
|
|
@ -337,11 +337,11 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) {
|
|||
#else
|
||||
// Posix case.
|
||||
{
|
||||
off_t li = lseek(_fd, off, SEEK_END);
|
||||
if (li == (size_t)-1) {
|
||||
return -1;
|
||||
}
|
||||
new_pos = (size_t)li;
|
||||
off_t li = lseek(_fd, off, SEEK_END);
|
||||
if (li == (size_t)-1) {
|
||||
return -1;
|
||||
}
|
||||
new_pos = (size_t)li;
|
||||
}
|
||||
#endif // _WIN32
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ FmodAudioManager() {
|
|||
result = _system->init(nchan, flags, 0);
|
||||
if (result == FMOD_ERR_TOOMANYCHANNELS) {
|
||||
fmodAudio_cat.error()
|
||||
<< "Value too large for fmod-number-of-sound-channels: " << nchan
|
||||
<< "\n";
|
||||
<< "Value too large for fmod-number-of-sound-channels: " << nchan
|
||||
<< "\n";
|
||||
} else {
|
||||
fmod_audio_errcheck("_system->init()", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||
// Get the MIDI parameters.
|
||||
memcpy(&sound_info, &_manager->_midi_info, sizeof(sound_info));
|
||||
if (sound_info.dlsname != NULL) {
|
||||
audio_debug("Using DLS file " << sound_info.dlsname);
|
||||
audio_debug("Using DLS file " << sound_info.dlsname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,13 +115,13 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||
file->read_file(mem_buffer, true);
|
||||
sound_info.length = mem_buffer.size();
|
||||
if (mem_buffer.size() != 0) {
|
||||
name_or_data = (const char *)&mem_buffer[0];
|
||||
name_or_data = (const char *)&mem_buffer[0];
|
||||
}
|
||||
flags |= FMOD_OPENMEMORY;
|
||||
if (fmodAudio_cat.is_debug()) {
|
||||
fmodAudio_cat.debug()
|
||||
<< "Reading " << _file_name << " into memory (" << sound_info.length
|
||||
<< " bytes)\n";
|
||||
fmodAudio_cat.debug()
|
||||
<< "Reading " << _file_name << " into memory (" << sound_info.length
|
||||
<< " bytes)\n";
|
||||
}
|
||||
|
||||
} else if (file->get_system_info(info)) {
|
||||
|
|
@ -136,9 +136,9 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||
sound_info.length = (unsigned int)info.get_size();
|
||||
flags |= FMOD_CREATESTREAM;
|
||||
if (fmodAudio_cat.is_debug()) {
|
||||
fmodAudio_cat.debug()
|
||||
<< "Streaming " << _file_name << " from disk (" << name_or_data
|
||||
<< ", " << sound_info.fileoffset << ", " << sound_info.length << ")\n";
|
||||
fmodAudio_cat.debug()
|
||||
<< "Streaming " << _file_name << " from disk (" << name_or_data
|
||||
<< ", " << sound_info.fileoffset << ", " << sound_info.length << ")\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -153,8 +153,8 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||
sound_info.userseek = seek_callback;
|
||||
flags |= FMOD_CREATESTREAM;
|
||||
if (fmodAudio_cat.is_debug()) {
|
||||
fmodAudio_cat.debug()
|
||||
<< "Streaming " << _file_name << " from disk using callbacks\n";
|
||||
fmodAudio_cat.debug()
|
||||
<< "Streaming " << _file_name << " from disk using callbacks\n";
|
||||
}
|
||||
|
||||
#else // HAVE_THREADS && !SIMPLE_THREADS
|
||||
|
|
@ -162,7 +162,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) {
|
|||
name_or_data = "";
|
||||
|
||||
fmodAudio_cat.warning()
|
||||
<< "Cannot stream " << _file_name << "; file is not literally on disk.\n";
|
||||
<< "Cannot stream " << _file_name << "; file is not literally on disk.\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -949,9 +949,9 @@ get_finished_event() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
FMOD_RESULT F_CALLBACK FmodAudioSound::
|
||||
sound_end_callback(FMOD_CHANNEL * channel,
|
||||
FMOD_CHANNEL_CALLBACKTYPE type,
|
||||
void *commanddata1,
|
||||
void *commanddata2) {
|
||||
FMOD_CHANNEL_CALLBACKTYPE type,
|
||||
void *commanddata1,
|
||||
void *commanddata2) {
|
||||
// Fortunately, this callback is made synchronously rather than
|
||||
// asynchronously (it is triggered during System::update()), so we
|
||||
// don't have to worry about thread-related issues here.
|
||||
|
|
|
|||
|
|
@ -206,9 +206,9 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound {
|
|||
|
||||
static FMOD_RESULT F_CALLBACK
|
||||
sound_end_callback(FMOD_CHANNEL * channel,
|
||||
FMOD_CHANNEL_CALLBACKTYPE type,
|
||||
void *commanddata1,
|
||||
void *commanddata2);
|
||||
FMOD_CHANNEL_CALLBACKTYPE type,
|
||||
void *commanddata1,
|
||||
void *commanddata2);
|
||||
|
||||
static FMOD_RESULT F_CALLBACK
|
||||
open_callback(const char *name, int unicode, unsigned int *file_size,
|
||||
|
|
|
|||
|
|
@ -31,18 +31,18 @@ void AwMouseAndKeyboard::do_transmit_data(DataGraphTraverser *trav, const DataNo
|
|||
if (input.has_data(_button_events_input)) {
|
||||
const ButtonEventList *button_events;
|
||||
DCAST_INTO_V(button_events, input.get_data(_button_events_input).get_ptr());
|
||||
|
||||
|
||||
int num_events = button_events->get_num_events();
|
||||
for (int i = 0; i < num_events; i++) {
|
||||
const ButtonEvent &be = button_events->get_event(i);
|
||||
string event_name = be._button.get_name();
|
||||
printf("Button Event! : %s with code %i and index %i ", event_name.c_str(), be._keycode, be._button.get_index());
|
||||
if(be._type == ButtonEvent::T_down) printf("down");
|
||||
if(be._type == ButtonEvent::T_repeat) printf("repeat");
|
||||
if(be._type == ButtonEvent::T_up) printf("up");
|
||||
if(be._type == ButtonEvent::T_resume_down) printf("T_resume_down");
|
||||
printf("\n");
|
||||
}
|
||||
printf("Button Event! : %s with code %i and index %i ", event_name.c_str(), be._keycode, be._button.get_index());
|
||||
if(be._type == ButtonEvent::T_down) printf("down");
|
||||
if(be._type == ButtonEvent::T_repeat) printf("repeat");
|
||||
if(be._type == ButtonEvent::T_up) printf("up");
|
||||
if(be._type == ButtonEvent::T_resume_down) printf("T_resume_down");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAAWESOMIUM AwMouseAndKeyboard : public DataNode {
|
||||
//member data data
|
||||
protected:
|
||||
protected:
|
||||
// inputs adn output indices... initialized in constructor
|
||||
int _button_events_input;
|
||||
int _button_events_output;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ TypeHandle WebBrowserTexture::_type_handle;
|
|||
WebBrowserTexture::WebBrowserTexture(const WebBrowserTexture ©):
|
||||
Texture(copy)
|
||||
{
|
||||
//this kind of assumes that the previous texture
|
||||
//was initialized properly
|
||||
_aw_web_view = copy._aw_web_view;
|
||||
_update_active = copy._update_active;
|
||||
_flip_texture_active = copy._flip_texture_active;
|
||||
//this kind of assumes that the previous texture
|
||||
//was initialized properly
|
||||
_aw_web_view = copy._aw_web_view;
|
||||
_update_active = copy._update_active;
|
||||
_flip_texture_active = copy._flip_texture_active;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -47,9 +47,9 @@ Texture(name),
|
|||
_update_active(true),
|
||||
_flip_texture_active(false)
|
||||
{
|
||||
set_web_view(aw_web_view);
|
||||
set_minfilter(FT_linear);
|
||||
set_magfilter(FT_linear);
|
||||
set_web_view(aw_web_view);
|
||||
set_minfilter(FT_linear);
|
||||
set_magfilter(FT_linear);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ _flip_texture_active(false)
|
|||
////////////////////////////////////////////////////////////////////
|
||||
WebBrowserTexture::~WebBrowserTexture()
|
||||
{
|
||||
//do nothing
|
||||
//do nothing
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ WebBrowserTexture::~WebBrowserTexture()
|
|||
// destructing happens in parent texture class.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool WebBrowserTexture::get_keep_ram_image() const {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -82,8 +82,8 @@ bool WebBrowserTexture::get_keep_ram_image() const {
|
|||
// This is essentially a sub.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WebBrowserTexture::do_reload_ram_image() {
|
||||
// A MovieTexture should never dump its RAM image.
|
||||
// Therefore, this is not needed.
|
||||
// A MovieTexture should never dump its RAM image.
|
||||
// Therefore, this is not needed.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -99,7 +99,7 @@ void WebBrowserTexture::do_reload_ram_image() {
|
|||
// the cull traverser method to do the texture udpate.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool WebBrowserTexture::has_cull_callback() const {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -111,7 +111,7 @@ bool WebBrowserTexture::has_cull_callback() const {
|
|||
// at the next time it is culled and rendered.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WebBrowserTexture::set_web_view(AwWebView* aw_web_view){
|
||||
_aw_web_view = aw_web_view;
|
||||
_aw_web_view = aw_web_view;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ void WebBrowserTexture::set_web_view(AwWebView* aw_web_view){
|
|||
// Description: Gets the current internal AwWebView of this texture.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
AwWebView* WebBrowserTexture::get_web_view() const{
|
||||
return _aw_web_view;
|
||||
return _aw_web_view;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ AwWebView* WebBrowserTexture::get_web_view() const{
|
|||
// active.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WebBrowserTexture::set_update_active(bool active_flag){
|
||||
_update_active = active_flag;
|
||||
_update_active = active_flag;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ void WebBrowserTexture::set_update_active(bool active_flag){
|
|||
// itself every time it is rendered.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool WebBrowserTexture::get_update_active() const{
|
||||
return _update_active;
|
||||
return _update_active;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ bool WebBrowserTexture::get_update_active() const{
|
|||
// coordinates or shaders.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WebBrowserTexture::set_flip_texture_active(bool active_flag){
|
||||
_flip_texture_active = active_flag;
|
||||
_flip_texture_active = active_flag;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -173,7 +173,7 @@ void WebBrowserTexture::set_flip_texture_active(bool active_flag){
|
|||
// enabled.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool WebBrowserTexture::get_flip_texture_active() const {
|
||||
return _flip_texture_active;
|
||||
return _flip_texture_active;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -186,48 +186,48 @@ bool WebBrowserTexture::get_flip_texture_active() const {
|
|||
// does not call the update method of AwWebCore.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool WebBrowserTexture::cull_callback(CullTraverser *trav, const CullTraverserData &data) const{
|
||||
//see if we are in a state where udpates can happen. else just return
|
||||
if( !_update_active ) return true;
|
||||
if( _aw_web_view == NULL ) return true;
|
||||
//see if we are in a state where udpates can happen. else just return
|
||||
if( !_update_active ) return true;
|
||||
if( _aw_web_view == NULL ) return true;
|
||||
|
||||
//do we even need to update?
|
||||
if( !_aw_web_view->is_dirty() ) return true;
|
||||
//do we even need to update?
|
||||
if( !_aw_web_view->is_dirty() ) return true;
|
||||
|
||||
//see if we're the same size, if not we need to make sure this texture
|
||||
//matches the webview
|
||||
if( _aw_web_view->get_width() != get_x_size() || _aw_web_view->get_height() != get_y_size() || get_texture_type() != TT_2d_texture){
|
||||
//these casts are so dirty especially when the method itself is
|
||||
//labled as const. Really Texture::cull_callback should be not const
|
||||
//first clean up
|
||||
((WebBrowserTexture*)this)->clear_ram_mipmap_images();
|
||||
((WebBrowserTexture*)this)->clear_ram_image();
|
||||
//now set up the texture again
|
||||
((WebBrowserTexture*)this)->setup_2d_texture( _aw_web_view->get_width(), _aw_web_view->get_height(), T_unsigned_byte, F_rgba );
|
||||
//should be good to go at this point
|
||||
}
|
||||
//see if we're the same size, if not we need to make sure this texture
|
||||
//matches the webview
|
||||
if( _aw_web_view->get_width() != get_x_size() || _aw_web_view->get_height() != get_y_size() || get_texture_type() != TT_2d_texture){
|
||||
//these casts are so dirty especially when the method itself is
|
||||
//labled as const. Really Texture::cull_callback should be not const
|
||||
//first clean up
|
||||
((WebBrowserTexture*)this)->clear_ram_mipmap_images();
|
||||
((WebBrowserTexture*)this)->clear_ram_image();
|
||||
//now set up the texture again
|
||||
((WebBrowserTexture*)this)->setup_2d_texture( _aw_web_view->get_width(), _aw_web_view->get_height(), T_unsigned_byte, F_rgba );
|
||||
//should be good to go at this point
|
||||
}
|
||||
|
||||
//get the pointer
|
||||
PTA_uchar ram_image = ((WebBrowserTexture*)this)->modify_ram_image();
|
||||
unsigned char* cp_data = ram_image.p();
|
||||
//render it
|
||||
_aw_web_view->render((void*)cp_data, get_x_size()*4, 4);
|
||||
//get the pointer
|
||||
PTA_uchar ram_image = ((WebBrowserTexture*)this)->modify_ram_image();
|
||||
unsigned char* cp_data = ram_image.p();
|
||||
//render it
|
||||
_aw_web_view->render((void*)cp_data, get_x_size()*4, 4);
|
||||
|
||||
if(_flip_texture_active){
|
||||
//flips the texture around... this is super slow. Really this should
|
||||
//never be enabled. However beginners might find this useful
|
||||
size_t width = get_x_size();
|
||||
size_t height = get_y_size();
|
||||
for(size_t i=0; i < height/2; i++){
|
||||
for(size_t j=0; j < width; j++){
|
||||
unsigned char tmp[4];
|
||||
size_t a_pos = j+width*i;
|
||||
size_t b_pos = j + width*(height-i-1);
|
||||
memcpy(tmp,&cp_data[4*a_pos], 4); //tmp = a
|
||||
memcpy(&cp_data[4*a_pos], &cp_data[4*b_pos], 4); //a = b
|
||||
memcpy(&cp_data[4*b_pos], tmp, 4); //b = tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
//success
|
||||
return true;
|
||||
if(_flip_texture_active){
|
||||
//flips the texture around... this is super slow. Really this should
|
||||
//never be enabled. However beginners might find this useful
|
||||
size_t width = get_x_size();
|
||||
size_t height = get_y_size();
|
||||
for(size_t i=0; i < height/2; i++){
|
||||
for(size_t j=0; j < width; j++){
|
||||
unsigned char tmp[4];
|
||||
size_t a_pos = j+width*i;
|
||||
size_t b_pos = j + width*(height-i-1);
|
||||
memcpy(tmp,&cp_data[4*a_pos], 4); //tmp = a
|
||||
memcpy(&cp_data[4*a_pos], &cp_data[4*b_pos], 4); //a = b
|
||||
memcpy(&cp_data[4*b_pos], tmp, 4); //b = tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
//success
|
||||
return true;
|
||||
}
|
||||
|
|
@ -29,53 +29,53 @@
|
|||
//
|
||||
// The use of class means that you will have to
|
||||
// follow Awesomium license agreement give below
|
||||
// http://www.khrona.com/products/awesomium/licensing/
|
||||
// http://www.khrona.com/products/awesomium/licensing/
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAAWESOMIUM WebBrowserTexture : public Texture {
|
||||
protected:
|
||||
AwWebView* _aw_web_view;
|
||||
bool _update_active;
|
||||
bool _flip_texture_active;
|
||||
AwWebView* _aw_web_view;
|
||||
bool _update_active;
|
||||
bool _flip_texture_active;
|
||||
|
||||
//Constructors & Destructors ------------
|
||||
private:
|
||||
WebBrowserTexture(const WebBrowserTexture ©);
|
||||
WebBrowserTexture(const WebBrowserTexture ©);
|
||||
PUBLISHED:
|
||||
WebBrowserTexture(const string &name, AwWebView* aw_web_view = NULL);
|
||||
virtual ~WebBrowserTexture();
|
||||
WebBrowserTexture(const string &name, AwWebView* aw_web_view = NULL);
|
||||
virtual ~WebBrowserTexture();
|
||||
|
||||
|
||||
//methods --------------
|
||||
protected:
|
||||
bool get_keep_ram_image() const;
|
||||
void do_reload_ram_image();
|
||||
bool get_keep_ram_image() const;
|
||||
void do_reload_ram_image();
|
||||
public:
|
||||
virtual bool has_cull_callback() const;
|
||||
virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
|
||||
virtual bool has_cull_callback() const;
|
||||
virtual bool cull_callback(CullTraverser *trav, const CullTraverserData &data) const;
|
||||
PUBLISHED:
|
||||
void set_web_view(AwWebView* aw_web_view);
|
||||
AwWebView* get_web_view() const;
|
||||
void set_update_active(bool active_flag);
|
||||
bool get_update_active() const;
|
||||
void set_flip_texture_active(bool active_flag);
|
||||
bool get_flip_texture_active() const;
|
||||
void set_web_view(AwWebView* aw_web_view);
|
||||
AwWebView* get_web_view() const;
|
||||
void set_update_active(bool active_flag);
|
||||
bool get_update_active() const;
|
||||
void set_flip_texture_active(bool active_flag);
|
||||
bool get_flip_texture_active() const;
|
||||
|
||||
//Type handles ----------------
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
Texture::init_type();
|
||||
register_type(_type_handle, "WebBrowserTexture",
|
||||
Texture::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
Texture::init_type();
|
||||
register_type(_type_handle, "WebBrowserTexture",
|
||||
Texture::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ PUBLISHED:
|
|||
*/
|
||||
enum LogLevel
|
||||
{
|
||||
LOG_NONE , // No log is created
|
||||
LOG_NORMAL , // Logs only errors
|
||||
LOG_VERBOSE // Logs everything
|
||||
LOG_NONE , // No log is created
|
||||
LOG_NORMAL , // Logs only errors
|
||||
LOG_VERBOSE // Logs everything
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -42,8 +42,8 @@ PUBLISHED:
|
|||
*/
|
||||
enum PixelFormat
|
||||
{
|
||||
PF_BGRA, // BGRA byte ordering [Blue, Green, Red, Alpha]
|
||||
PF_RGBA // RGBA byte ordering [Red, Green, Blue, Alpha]
|
||||
PF_BGRA, // BGRA byte ordering [Blue, Green, Red, Alpha]
|
||||
PF_RGBA // RGBA byte ordering [Red, Green, Blue, Alpha]
|
||||
};
|
||||
|
||||
AwWebCore(LogLevel level = LOG_NORMAL, bool enablePlugins = true, PixelFormat pixelFormat = PF_BGRA);
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ PUBLISHED:
|
|||
* and WebView::injectMouseUp
|
||||
*/
|
||||
enum MouseButton {
|
||||
LEFT_MOUSE_BTN,
|
||||
MIDDLE_MOUSE_BTN,
|
||||
RIGHT_MOUSE_BTN
|
||||
LEFT_MOUSE_BTN,
|
||||
MIDDLE_MOUSE_BTN,
|
||||
RIGHT_MOUSE_BTN
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,53 +29,53 @@ void AwWebViewListener::onBeginLoading(const std::string& url, const std::wstrin
|
|||
awesomium_cat.info() << "onBeginLoading" ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when all loads have finished for a WebView.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when all loads have finished for a WebView.
|
||||
*/
|
||||
void AwWebViewListener::onFinishLoading() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when a Client callback has been invoked via Javascript from a page.
|
||||
*
|
||||
* @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)").
|
||||
*
|
||||
* @param args The arguments passed to the callback.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when a Client callback has been invoked via Javascript from a page.
|
||||
*
|
||||
* @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)").
|
||||
*
|
||||
* @param args The arguments passed to the callback.
|
||||
*/
|
||||
void AwWebViewListener::onCallback(const std::string& name, const Awesomium::JSArguments& args) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when a page title is received.
|
||||
*
|
||||
* @param title The page title.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This event is fired when a page title is received.
|
||||
*
|
||||
* @param title The page title.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
void AwWebViewListener::onReceiveTitle(const std::wstring& title, const std::wstring& frameName) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when a tooltip has changed state.
|
||||
*
|
||||
* @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear).
|
||||
*/
|
||||
/**
|
||||
* This event is fired when a tooltip has changed state.
|
||||
*
|
||||
* @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear).
|
||||
*/
|
||||
void AwWebViewListener::onChangeTooltip(const std::wstring& tooltip) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when keyboard focus has changed.
|
||||
*
|
||||
* @param isFocused Whether or not the keyboard is currently focused.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when keyboard focus has changed.
|
||||
*
|
||||
* @param isFocused Whether or not the keyboard is currently focused.
|
||||
*/
|
||||
void AwWebViewListener::onChangeKeyboardFocus(bool isFocused) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when the target URL has changed. This is usually the result of
|
||||
* hovering over a link on the page.
|
||||
*
|
||||
* @param url The updated target URL (or empty if the target URL is cleared).
|
||||
*/
|
||||
/**
|
||||
* This event is fired when the target URL has changed. This is usually the result of
|
||||
* hovering over a link on the page.
|
||||
*
|
||||
* @param url The updated target URL (or empty if the target URL is cleared).
|
||||
*/
|
||||
void AwWebViewListener::onChangeTargetURL(const std::string& url) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,72 +33,72 @@ PUBLISHED:
|
|||
|
||||
virtual ~AwWebViewListener() {}
|
||||
|
||||
/**
|
||||
* This event is fired when a WebView begins navigating to a new URL.
|
||||
*
|
||||
* @param url The URL that is being navigated to.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
void onBeginNavigation(const std::string& url, const std::wstring& frameName) ;
|
||||
/**
|
||||
* This event is fired when a WebView begins navigating to a new URL.
|
||||
*
|
||||
* @param url The URL that is being navigated to.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
void onBeginNavigation(const std::string& url, const std::wstring& frameName) ;
|
||||
|
||||
/**
|
||||
* This event is fired when a WebView begins to actually receive data from a server.
|
||||
*
|
||||
* @param url The URL of the frame that is being loaded.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*
|
||||
* @param statusCode The HTTP status code returned by the server.
|
||||
*
|
||||
* @param mimeType The mime-type of the content that is being loaded.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when a WebView begins to actually receive data from a server.
|
||||
*
|
||||
* @param url The URL of the frame that is being loaded.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*
|
||||
* @param statusCode The HTTP status code returned by the server.
|
||||
*
|
||||
* @param mimeType The mime-type of the content that is being loaded.
|
||||
*/
|
||||
void onBeginLoading(const std::string& url, const std::wstring& frameName, int statusCode, const std::wstring& mimeType);
|
||||
|
||||
/**
|
||||
* This event is fired when all loads have finished for a WebView.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when all loads have finished for a WebView.
|
||||
*/
|
||||
void onFinishLoading();
|
||||
|
||||
/**
|
||||
* This event is fired when a Client callback has been invoked via Javascript from a page.
|
||||
*
|
||||
* @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)").
|
||||
*
|
||||
* @param args The arguments passed to the callback.
|
||||
*/
|
||||
/**
|
||||
* This event is fired when a Client callback has been invoked via Javascript from a page.
|
||||
*
|
||||
* @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)").
|
||||
*
|
||||
* @param args The arguments passed to the callback.
|
||||
*/
|
||||
void onCallback(const std::string& name, const Awesomium::JSArguments& args);
|
||||
|
||||
/**
|
||||
* This event is fired when a page title is received.
|
||||
*
|
||||
* @param title The page title.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This event is fired when a page title is received.
|
||||
*
|
||||
* @param title The page title.
|
||||
*
|
||||
* @param frameName The name of the frame that this event originated from.
|
||||
*/
|
||||
void onReceiveTitle(const std::wstring& title, const std::wstring& frameName) ;
|
||||
|
||||
/**
|
||||
* This event is fired when a tooltip has changed state.
|
||||
*
|
||||
* @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear).
|
||||
*/
|
||||
void onChangeTooltip(const std::wstring& tooltip);
|
||||
/**
|
||||
* This event is fired when a tooltip has changed state.
|
||||
*
|
||||
* @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear).
|
||||
*/
|
||||
void onChangeTooltip(const std::wstring& tooltip);
|
||||
|
||||
/**
|
||||
* This event is fired when keyboard focus has changed.
|
||||
*
|
||||
* @param isFocused Whether or not the keyboard is currently focused.
|
||||
*/
|
||||
void onChangeKeyboardFocus(bool isFocused) ;
|
||||
/**
|
||||
* This event is fired when keyboard focus has changed.
|
||||
*
|
||||
* @param isFocused Whether or not the keyboard is currently focused.
|
||||
*/
|
||||
void onChangeKeyboardFocus(bool isFocused) ;
|
||||
|
||||
/**
|
||||
* This event is fired when the target URL has changed. This is usually the result of
|
||||
* hovering over a link on the page.
|
||||
*
|
||||
* @param url The updated target URL (or empty if the target URL is cleared).
|
||||
*/
|
||||
void onChangeTargetURL(const std::string& url) ;
|
||||
/**
|
||||
* This event is fired when the target URL has changed. This is usually the result of
|
||||
* hovering over a link on the page.
|
||||
*
|
||||
* @param url The updated target URL (or empty if the target URL is cleared).
|
||||
*/
|
||||
void onChangeTargetURL(const std::string& url) ;
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -35,10 +35,8 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
PStatCollector CollisionBox::_volume_pcollector(
|
||||
"Collision Volumes:CollisionBox");
|
||||
PStatCollector CollisionBox::_test_pcollector(
|
||||
"Collision Tests:CollisionBox");
|
||||
PStatCollector CollisionBox::_volume_pcollector("Collision Volumes:CollisionBox");
|
||||
PStatCollector CollisionBox::_test_pcollector("Collision Tests:CollisionBox");
|
||||
TypeHandle CollisionBox::_type_handle;
|
||||
|
||||
const int CollisionBox::plane_def[6][4] = {
|
||||
|
|
@ -113,14 +111,14 @@ setup_points(const LPoint3f *begin, const LPoint3f *end, int plane) {
|
|||
/*
|
||||
// Now make sure the points define a convex polygon.
|
||||
if (is_concave()) {
|
||||
collide_cat.error() << "Invalid concave CollisionPolygon defined:\n";
|
||||
const LPoint3f *pi;
|
||||
for (pi = begin; pi != end; ++pi) {
|
||||
collide_cat.error(false) << " " << (*pi) << "\n";
|
||||
}
|
||||
collide_cat.error(false)
|
||||
<< " normal " << normal << " with length " << normal.length() << "\n";
|
||||
_points.clear();
|
||||
collide_cat.error() << "Invalid concave CollisionPolygon defined:\n";
|
||||
const LPoint3f *pi;
|
||||
for (pi = begin; pi != end; ++pi) {
|
||||
collide_cat.error(false) << " " << (*pi) << "\n";
|
||||
}
|
||||
collide_cat.error(false)
|
||||
<< " normal " << normal << " with length " << normal.length() << "\n";
|
||||
_points.clear();
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
|
@ -147,9 +145,9 @@ void CollisionBox::
|
|||
xform(const LMatrix4f &mat) {
|
||||
_center = _center * mat;
|
||||
for(int v = 0; v < 8; v++)
|
||||
_vertex[v] = _vertex[v] * mat;
|
||||
_vertex[v] = _vertex[v] * mat;
|
||||
for(int p = 0; p < 6 ; p++)
|
||||
_planes[p] = set_plane(p);
|
||||
_planes[p] = set_plane(p);
|
||||
_x = _vertex[0].get_x()-_center.get_x();
|
||||
_y = _vertex[0].get_y()-_center.get_y();
|
||||
_z = _vertex[0].get_z()-_center.get_z();
|
||||
|
|
@ -276,7 +274,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
|||
|
||||
int ip;
|
||||
float max_dist = 0.0;
|
||||
float dist = 0.0;
|
||||
float dist = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
LVector3f normal;
|
||||
|
|
@ -287,75 +285,75 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
|||
continue;
|
||||
}
|
||||
if (wrt_prev_space != wrt_space) {
|
||||
// If we have a delta between the previous position and the
|
||||
// current position, we use that to determine some more properties
|
||||
// of the collision.
|
||||
LPoint3f b = from_center;
|
||||
LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat();
|
||||
LVector3f delta = b - a;
|
||||
// If we have a delta between the previous position and the
|
||||
// current position, we use that to determine some more properties
|
||||
// of the collision.
|
||||
LPoint3f b = from_center;
|
||||
LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat();
|
||||
LVector3f delta = b - a;
|
||||
|
||||
// First, there is no collision if the "from" object is definitely
|
||||
// moving in the same direction as the plane's normal.
|
||||
float dot = delta.dot(plane.get_normal());
|
||||
if (dot > 0.1f) {
|
||||
continue; // no intersection
|
||||
}
|
||||
// First, there is no collision if the "from" object is definitely
|
||||
// moving in the same direction as the plane's normal.
|
||||
float dot = delta.dot(plane.get_normal());
|
||||
if (dot > 0.1f) {
|
||||
continue; // no intersection
|
||||
}
|
||||
|
||||
if (IS_NEARLY_ZERO(dot)) {
|
||||
// If we're moving parallel to the plane, the sphere is tested
|
||||
// at its final point. Leave it as it is.
|
||||
if (IS_NEARLY_ZERO(dot)) {
|
||||
// If we're moving parallel to the plane, the sphere is tested
|
||||
// at its final point. Leave it as it is.
|
||||
|
||||
} else {
|
||||
// Otherwise, we're moving into the plane; the sphere is tested
|
||||
// at the point along its path that is closest to intersecting
|
||||
// the plane. This may be the actual intersection point, or it
|
||||
// may be the starting point or the final point.
|
||||
// dot is equal to the (negative) magnitude of 'delta' along the
|
||||
// direction of the plane normal
|
||||
// t = ratio of (distance from start pos to plane) to (distance
|
||||
// from start pos to end pos), along axis of plane normal
|
||||
float dist_to_p = plane.dist_to_plane(a);
|
||||
t = (dist_to_p / -dot);
|
||||
} else {
|
||||
// Otherwise, we're moving into the plane; the sphere is tested
|
||||
// at the point along its path that is closest to intersecting
|
||||
// the plane. This may be the actual intersection point, or it
|
||||
// may be the starting point or the final point.
|
||||
// dot is equal to the (negative) magnitude of 'delta' along the
|
||||
// direction of the plane normal
|
||||
// t = ratio of (distance from start pos to plane) to (distance
|
||||
// from start pos to end pos), along axis of plane normal
|
||||
float dist_to_p = plane.dist_to_plane(a);
|
||||
t = (dist_to_p / -dot);
|
||||
|
||||
// also compute the actual contact point and time of contact
|
||||
// for handlers that need it
|
||||
actual_t = ((dist_to_p - from_radius) / -dot);
|
||||
actual_t = min(1.0f, max(0.0f, actual_t));
|
||||
contact_point = a + (actual_t * delta);
|
||||
// also compute the actual contact point and time of contact
|
||||
// for handlers that need it
|
||||
actual_t = ((dist_to_p - from_radius) / -dot);
|
||||
actual_t = min(1.0f, max(0.0f, actual_t));
|
||||
contact_point = a + (actual_t * delta);
|
||||
|
||||
if (t >= 1.0f) {
|
||||
if (t >= 1.0f) {
|
||||
// Leave it where it is.
|
||||
|
||||
} else if (t < 0.0f) {
|
||||
from_center = a;
|
||||
moved_from_center = true;
|
||||
} else {
|
||||
from_center = a + t * delta;
|
||||
moved_from_center = true;
|
||||
}
|
||||
} else if (t < 0.0f) {
|
||||
from_center = a;
|
||||
moved_from_center = true;
|
||||
} else {
|
||||
from_center = a + t * delta;
|
||||
moved_from_center = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : plane.get_normal();
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
/*if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001), NULL) {
|
||||
std::cout
|
||||
<< "polygon within " << entry.get_into_node_path()
|
||||
<< " has normal " << normal << " of length " << normal.length()
|
||||
<< "\n";
|
||||
normal.normalize();
|
||||
}*/
|
||||
#endif
|
||||
}*/
|
||||
#endif
|
||||
|
||||
// The nearest point within the plane to our center is the
|
||||
// intersection of the line (center, center - normal) with the plane.
|
||||
|
||||
if (!plane.intersects_line(dist, from_center, -(plane.get_normal()))) {
|
||||
// No intersection with plane? This means the plane's effective
|
||||
// normal was within the plane itself. A useless polygon.
|
||||
continue;
|
||||
}
|
||||
// No intersection with plane? This means the plane's effective
|
||||
// normal was within the plane itself. A useless polygon.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dist > from_radius || dist < -from_radius) {
|
||||
// No intersection with the plane.
|
||||
|
|
@ -394,7 +392,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
|||
}
|
||||
|
||||
if((edge_dist > 0) &&
|
||||
((edge_dist * edge_dist + dist * dist) > from_radius_2)) {
|
||||
((edge_dist * edge_dist + dist * dist) > from_radius_2)) {
|
||||
// No intersection; the circle is outside the polygon.
|
||||
continue;
|
||||
}
|
||||
|
|
@ -465,7 +463,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
|
|||
|
||||
int i, j;
|
||||
float t;
|
||||
float near_t = 0.0;
|
||||
float near_t = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
Planef near_plane;
|
||||
|
|
@ -507,8 +505,8 @@ test_intersection_from_ray(const CollisionEntry &entry) const {
|
|||
|
||||
|
||||
if(!intersect) {
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
|
|
@ -549,7 +547,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
|
|||
|
||||
int i, j;
|
||||
float t;
|
||||
float near_t = 0.0;
|
||||
float near_t = 0.0;
|
||||
bool intersect;
|
||||
Planef plane;
|
||||
Planef near_plane;
|
||||
|
|
@ -592,8 +590,8 @@ test_intersection_from_segment(const CollisionEntry &entry) const {
|
|||
|
||||
|
||||
if(!intersect) {
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
//No intersection with ANY of the box's planes has been detected
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
|
|
@ -987,7 +985,7 @@ point_is_inside(const LPoint2f &p, const CollisionBox::Points &points) const {
|
|||
}
|
||||
}
|
||||
if (is_right(p - points[points.size() - 1]._p,
|
||||
points[0]._p - points[points.size() - 1]._p)) {
|
||||
points[0]._p - points[points.size() - 1]._p)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
class EXPCL_PANDA_COLLIDE CollisionBox : public CollisionSolid {
|
||||
PUBLISHED:
|
||||
INLINE CollisionBox(const LPoint3f ¢er,
|
||||
float x, float y, float z);
|
||||
INLINE CollisionBox(float cx, float cy, float cz,
|
||||
float x, float y, float z);
|
||||
float x, float y, float z);
|
||||
INLINE CollisionBox(float cx, float cy, float cz,
|
||||
float x, float y, float z);
|
||||
INLINE CollisionBox(const LPoint3f &min, const LPoint3f &max);
|
||||
|
||||
virtual LPoint3f get_collision_origin() const;
|
||||
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual CollisionSolid *make_copy();
|
||||
|
||||
virtual PT(CollisionEntry)
|
||||
test_intersection(const CollisionEntry &entry) const;
|
||||
test_intersection(const CollisionEntry &entry) const;
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
||||
virtual PStatCollector &get_volume_pcollector();
|
||||
|
|
@ -74,13 +74,13 @@ PUBLISHED:
|
|||
protected:
|
||||
virtual PT(BoundingVolume) compute_internal_bounds() const;
|
||||
virtual PT(CollisionEntry)
|
||||
test_intersection_from_sphere(const CollisionEntry &entry) const;
|
||||
test_intersection_from_sphere(const CollisionEntry &entry) const;
|
||||
virtual PT(CollisionEntry)
|
||||
test_intersection_from_ray(const CollisionEntry &entry) const;
|
||||
test_intersection_from_ray(const CollisionEntry &entry) const;
|
||||
virtual PT(CollisionEntry)
|
||||
test_intersection_from_segment(const CollisionEntry &entry) const;
|
||||
test_intersection_from_segment(const CollisionEntry &entry) const;
|
||||
virtual PT(CollisionEntry)
|
||||
test_intersection_from_box(const CollisionEntry &entry) const;
|
||||
test_intersection_from_box(const CollisionEntry &entry) const;
|
||||
|
||||
virtual void fill_viz_geom();
|
||||
|
||||
|
|
|
|||
|
|
@ -348,12 +348,12 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
|
|||
(plane == RTP_aux_float_1)||
|
||||
(plane == RTP_aux_float_2)||
|
||||
(plane == RTP_aux_float_3)) {
|
||||
//defaults to rgba16 unless rgba32 is set. Since many older hardware doesn't
|
||||
//support 32 or filtering on 32
|
||||
tex->set_component_type(Texture::T_float);
|
||||
if( tex->get_format() != Texture::F_rgba32 ){
|
||||
tex->set_format(Texture::F_rgba16);
|
||||
}
|
||||
// defaults to rgba16 unless rgba32 is set. Since many older hardware doesn't
|
||||
// support 32 or filtering on 32
|
||||
tex->set_component_type(Texture::T_float);
|
||||
if( tex->get_format() != Texture::F_rgba32 ){
|
||||
tex->set_format(Texture::F_rgba16);
|
||||
}
|
||||
tex->set_match_framebuffer_format(true);
|
||||
} else {
|
||||
display_cat.error() <<
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ GraphicsWindowProc(){
|
|||
////////////////////////////////////////////////////////////////////
|
||||
LONG GraphicsWindowProc::
|
||||
wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1005,7 +1005,7 @@ string_cs_type(const string &strval) {
|
|||
} else if (cmp_nocase_uh(strval, "tube") == 0) {
|
||||
return CST_tube;
|
||||
} else if (cmp_nocase_uh(strval, "floor-mesh") == 0 ||
|
||||
cmp_nocase_uh(strval, "floormesh") == 0) {
|
||||
cmp_nocase_uh(strval, "floormesh") == 0) {
|
||||
return CST_floor_mesh;
|
||||
} else {
|
||||
return CST_none;
|
||||
|
|
|
|||
|
|
@ -2650,7 +2650,7 @@ set_occluder_polygon(EggGroup *egg_group, OccluderNode *pnode) {
|
|||
LCAST(float, v3));
|
||||
|
||||
if (poly->get_bface_flag()) {
|
||||
pnode->set_double_sided(true);
|
||||
pnode->set_double_sided(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -574,9 +574,9 @@ operator >> (istream &in, AutoTextureScale &ats) {
|
|||
ats = ATS_none;
|
||||
|
||||
} else if (cmp_nocase(word, "down") == 0 ||
|
||||
cmp_nocase(word, "1") == 0 ||
|
||||
cmp_nocase(word, "#t") == 0 ||
|
||||
(!word.empty() && tolower(word[0]) == 't')) {
|
||||
cmp_nocase(word, "1") == 0 ||
|
||||
cmp_nocase(word, "#t") == 0 ||
|
||||
(!word.empty() && tolower(word[0]) == 't')) {
|
||||
ats = ATS_down;
|
||||
|
||||
} else if (cmp_nocase(word, "up") == 0) {
|
||||
|
|
@ -624,9 +624,9 @@ operator >> (istream &in, ShaderUtilization &sgc) {
|
|||
sgc = SUT_none;
|
||||
|
||||
} else if (cmp_nocase(word, "basic") == 0 ||
|
||||
cmp_nocase(word, "1") == 0 ||
|
||||
cmp_nocase(word, "#t") == 0 ||
|
||||
(!word.empty() && tolower(word[0]) == 't')) {
|
||||
cmp_nocase(word, "1") == 0 ||
|
||||
cmp_nocase(word, "#t") == 0 ||
|
||||
(!word.empty() && tolower(word[0]) == 't')) {
|
||||
sgc = SUT_basic;
|
||||
|
||||
} else if (cmp_nocase(word, "advanced") == 0) {
|
||||
|
|
|
|||
|
|
@ -724,7 +724,7 @@ do_register() {
|
|||
if (array_format->get_num_columns() == 0) {
|
||||
// Don't keep an empty array.
|
||||
gobj_cat.warning()
|
||||
<< "Dropping empty array from GeomVertexFormat.\n";
|
||||
<< "Dropping empty array from GeomVertexFormat.\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1075,8 +1075,8 @@ register_format(GeomVertexFormat *format) {
|
|||
if (!new_format->is_registered()) {
|
||||
new_format->do_register();
|
||||
if (new_format->get_num_arrays() == 0) {
|
||||
gobj_cat.warning()
|
||||
<< "Empty GeomVertexFormat registered.\n";
|
||||
gobj_cat.warning()
|
||||
<< "Empty GeomVertexFormat registered.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6867,7 +6867,7 @@ do_write_datagram_header(BamWriter *manager, Datagram &me, bool &has_rawdata) {
|
|||
// disk.
|
||||
BamWriter::BamTextureMode file_texture_mode = manager->get_file_texture_mode();
|
||||
has_rawdata = (file_texture_mode == BamWriter::BTM_rawdata ||
|
||||
(_filename.empty() && do_has_bam_rawdata()));
|
||||
(_filename.empty() && do_has_bam_rawdata()));
|
||||
if (has_rawdata && !do_has_bam_rawdata()) {
|
||||
do_get_bam_rawdata();
|
||||
if (!do_has_bam_rawdata()) {
|
||||
|
|
@ -7129,8 +7129,8 @@ make_this_from_bam(const FactoryParams ¶ms) {
|
|||
|
||||
if (me != (Texture *)NULL) {
|
||||
{
|
||||
MutexHolder holder(me->_lock);
|
||||
me->do_fillin_from(dummy);
|
||||
MutexHolder holder(me->_lock);
|
||||
me->do_fillin_from(dummy);
|
||||
}
|
||||
me->set_name(name);
|
||||
|
||||
|
|
|
|||
|
|
@ -275,15 +275,15 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
|
|||
filename.set_binary();
|
||||
PT(VirtualFile) file = vfs->get_file(filename);
|
||||
if (file == (VirtualFile *)NULL) {
|
||||
// No such file.
|
||||
gobj_cat.error()
|
||||
<< "Could not find " << filename << "\n";
|
||||
return false;
|
||||
// No such file.
|
||||
gobj_cat.error()
|
||||
<< "Could not find " << filename << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gobj_cat.is_debug()) {
|
||||
gobj_cat.debug()
|
||||
<< "Reading texture object " << filename << "\n";
|
||||
gobj_cat.debug()
|
||||
<< "Reading texture object " << filename << "\n";
|
||||
}
|
||||
|
||||
istream *in = file->open_read_file(true);
|
||||
|
|
@ -291,20 +291,20 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
|
|||
vfs->close_read_file(in);
|
||||
|
||||
if (tex == (Texture *)NULL) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
tex->set_fullpath(filename);
|
||||
tex->clear_alpha_fullpath();
|
||||
tex->set_keep_ram_image(false);
|
||||
|
||||
|
||||
} else {
|
||||
// Read it the conventional way.
|
||||
tex = make_texture(ext);
|
||||
if (!tex->read(filename, Filename(), primary_file_num_channels, 0,
|
||||
0, 0, false, read_mipmaps, record, options)) {
|
||||
// This texture was not found or could not be read.
|
||||
report_texture_unreadable(filename);
|
||||
return NULL;
|
||||
0, 0, false, read_mipmaps, record, options)) {
|
||||
// This texture was not found or could not be read.
|
||||
report_texture_unreadable(filename);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ do_reconsider_video_properties(const FFMpegTexture::VideoStream &stream,
|
|||
if (grutil_cat.is_debug()) {
|
||||
grutil_cat.debug()
|
||||
<< "Loaded " << stream._filename << ", "
|
||||
<< num_frames << " frames at " << frame_rate << " fps\n";
|
||||
<< num_frames << " frames at " << frame_rate << " fps\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ set_far(double input_far) {
|
|||
// Function: GeoMipTerrain::get_far
|
||||
// Access: Published
|
||||
// Description: Returns the far LOD distance in the terrain coordinate
|
||||
// space
|
||||
// space
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double GeoMipTerrain::
|
||||
get_far() {
|
||||
|
|
@ -354,7 +354,7 @@ get_far() {
|
|||
// Function: GeoMipTerrain::get_near
|
||||
// Access: Published
|
||||
// Description: Returns the near LOD distance in the terrain coordinate
|
||||
// space
|
||||
// space
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double GeoMipTerrain::
|
||||
get_near() {
|
||||
|
|
|
|||
|
|
@ -629,9 +629,9 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) {
|
|||
// If it's not a valid size, tell PNMImage to resize it.
|
||||
if (reqx != (unsigned int)imgheader.get_x_size() || reqy != (unsigned int)imgheader.get_y_size()) {
|
||||
grutil_cat.warning()
|
||||
<< "Rescaling heightfield image " << filename
|
||||
<< " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size()
|
||||
<< " to " << reqx << "x" << reqy << " pixels.\n";
|
||||
<< "Rescaling heightfield image " << filename
|
||||
<< " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size()
|
||||
<< " to " << reqx << "x" << reqy << " pixels.\n";
|
||||
_heightfield.set_read_size(reqx, reqy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
|||
prim_vertex_reader->set_row_unsafe(vidx);
|
||||
prim_uv_reader->set_row_unsafe(vidx);
|
||||
vec[indx_over] = _render.get_relative_point(
|
||||
current_node_path,prim_vertex_reader->get_data3f());
|
||||
current_node_path,prim_vertex_reader->get_data3f());
|
||||
uv[indx_over] = prim_uv_reader->get_data2f();
|
||||
indx_over++;
|
||||
if (indx_over > 2) break;
|
||||
|
|
@ -424,8 +424,8 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
|||
|
||||
// draw polygon
|
||||
tri(vec[0],color,uv[0],
|
||||
vec[1],color,uv[1],
|
||||
vec[2],color,uv[2]);
|
||||
vec[1],color,uv[1],
|
||||
vec[2],color,uv[2]);
|
||||
}
|
||||
// if we are over budget just quit
|
||||
if( _clear_index > _end_clear_index) return;
|
||||
|
|
@ -449,7 +449,7 @@ void MeshDrawer::geometry(NodePath draw_node) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void MeshDrawer::
|
||||
link_segment(LVector3f pos, LVector4f frame,
|
||||
float thickness, LVector4f color) {
|
||||
float thickness, LVector4f color) {
|
||||
assert(_render.get_error_type() == NodePath::ET_ok);
|
||||
assert(_camera.get_error_type() == NodePath::ET_ok);
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ init_from(FfmpegVideo *source) {
|
|||
// Read a subfile.
|
||||
if (!_ffvfile.open_subfile(_source->get_subfile_info())) {
|
||||
movies_cat.info()
|
||||
<< "Couldn't open " << _source->get_subfile_info() << "\n";
|
||||
<< "Couldn't open " << _source->get_subfile_info() << "\n";
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ init_from(FfmpegVideo *source) {
|
|||
// Read a filename.
|
||||
if (!_ffvfile.open_vfs(_filename)) {
|
||||
movies_cat.info()
|
||||
<< "Couldn't open " << _filename << "\n";
|
||||
<< "Couldn't open " << _filename << "\n";
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ get_datagram(Datagram &data) {
|
|||
net_cat.spam()
|
||||
<< "DatagramGeneratorNet returning EOF\n";
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
poll();
|
||||
Thread::force_yield();
|
||||
|
|
@ -86,7 +86,7 @@ get_datagram(Datagram &data) {
|
|||
net_cat.spam()
|
||||
<< "DatagramGeneratorNet returning EOF\n";
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
if (net_cat.is_spam()) {
|
||||
net_cat.spam()
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
|||
CPT(TransformState) temp_frustum_transform = data._node_path.get_node_path().get_net_transform()->invert_compose(portal_viewer->_scene_setup->get_cull_center().get_net_transform());
|
||||
|
||||
portal_cat.spam() << "clipping plane frustum transform " << *temp_frustum_transform << endl;
|
||||
portal_cat.spam() << "frustum before transform " << *temp_bh << endl;
|
||||
portal_cat.spam() << "frustum before transform " << *temp_bh << endl;
|
||||
// transform to portalNode space
|
||||
temp_bh->xform(temp_frustum_transform->get_mat());
|
||||
|
||||
|
|
|
|||
|
|
@ -311,19 +311,19 @@ analyze_renderstate(const RenderState *rs) {
|
|||
if (tex_gen->has_stage(stage)) {
|
||||
switch (tex_gen->get_mode(stage)) {
|
||||
case TexGenAttrib::M_world_position:
|
||||
_need_world_position = true;
|
||||
break;
|
||||
_need_world_position = true;
|
||||
break;
|
||||
case TexGenAttrib::M_world_normal:
|
||||
_need_world_normal = true;
|
||||
break;
|
||||
_need_world_normal = true;
|
||||
break;
|
||||
case TexGenAttrib::M_eye_position:
|
||||
_need_eye_position = true;
|
||||
break;
|
||||
_need_eye_position = true;
|
||||
break;
|
||||
case TexGenAttrib::M_eye_normal:
|
||||
_need_eye_normal = true;
|
||||
break;
|
||||
_need_eye_normal = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -964,16 +964,16 @@ synthesize_shader(const RenderState *rs) {
|
|||
switch(tex->get_texture_type()) {
|
||||
case Texture::TT_cube_map:
|
||||
case Texture::TT_3d_texture:
|
||||
text << "xyz";
|
||||
break;
|
||||
text << "xyz";
|
||||
break;
|
||||
case Texture::TT_2d_texture:
|
||||
text << "xy";
|
||||
break;
|
||||
text << "xy";
|
||||
break;
|
||||
case Texture::TT_1d_texture:
|
||||
text << "x";
|
||||
break;
|
||||
text << "x";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
text << ");\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1214,9 +1214,9 @@ p_read_object() {
|
|||
{
|
||||
SubfileInfo info;
|
||||
if (!_source->save_datagram(info)) {
|
||||
bam_cat.error()
|
||||
<< "Failed to read file data.\n";
|
||||
return 0;
|
||||
bam_cat.error()
|
||||
<< "Failed to read file data.\n";
|
||||
return 0;
|
||||
}
|
||||
_file_data_records.push_back(info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ save_datagram(SubfileInfo &info) {
|
|||
out.write(buffer, count);
|
||||
if (out.fail()) {
|
||||
util_cat.error()
|
||||
<< "Couldn't write " << num_bytes << " bytes to "
|
||||
<< tfile->get_filename() << "\n";
|
||||
<< "Couldn't write " << num_bytes << " bytes to "
|
||||
<< tfile->get_filename() << "\n";
|
||||
return false;
|
||||
}
|
||||
num_remaining -= count;
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ ConfigVariableString speedtree_license
|
|||
ConfigVariableFilename speedtree_shaders_dir
|
||||
("speedtree-shaders-dir", Filename(Filename::from_os_specific(SPEEDTREE_BIN_DIR), "Shaders"),
|
||||
PRC_DESC("Specifies the directory in which to locate SpeedTree's system "
|
||||
"shaders at runtime. If this is empty, the default is based on "
|
||||
"SPEEDTREE_BIN_DIR, as provided at compile time."));
|
||||
"shaders at runtime. If this is empty, the default is based on "
|
||||
"SPEEDTREE_BIN_DIR, as provided at compile time."));
|
||||
#endif // CPPPARSER
|
||||
|
||||
ConfigVariableFilename speedtree_textures_dir
|
||||
("speedtree-textures-dir", "",
|
||||
PRC_DESC("Specifies the directory in which to locate textures referenced "
|
||||
"by SRT files at runtime. The default is to search in the same "
|
||||
"directory as the SRT file itself. Unfortunately, the model-path "
|
||||
"cannot be searched, because SpeedTree only provides a single "
|
||||
"directory option."));
|
||||
"by SRT files at runtime. The default is to search in the same "
|
||||
"directory as the SRT file itself. Unfortunately, the model-path "
|
||||
"cannot be searched, because SpeedTree only provides a single "
|
||||
"directory option."));
|
||||
|
||||
ConfigVariableDouble speedtree_max_anisotropy
|
||||
("speedtree-max-anisotropy", 0.0,
|
||||
|
|
@ -56,9 +56,9 @@ ConfigVariableDouble speedtree_max_anisotropy
|
|||
ConfigVariableBool speedtree_horizontal_billboards
|
||||
("speedtree-horizontal-billboards", true,
|
||||
PRC_DESC("Set this true to allow the use of horizontal billboards in "
|
||||
"SpeedTree, or false to disallow them. Horizontal billboards "
|
||||
"may be defined for some trees to provide a billboard LOD "
|
||||
"when the tree is seen from above."));
|
||||
"SpeedTree, or false to disallow them. Horizontal billboards "
|
||||
"may be defined for some trees to provide a billboard LOD "
|
||||
"when the tree is seen from above."));
|
||||
|
||||
ConfigVariableDouble speedtree_alpha_test_scalar
|
||||
("speedtree-alpha-test-scalar", 0.57,
|
||||
|
|
@ -67,15 +67,15 @@ ConfigVariableDouble speedtree_alpha_test_scalar
|
|||
ConfigVariableBool speedtree_z_pre_pass
|
||||
("speedtree-z-pre-pass", false,
|
||||
PRC_DESC("True if the SpeedTree renderer should perform a first pass "
|
||||
"to fill the depth buffer before going back to draw pixels. "
|
||||
"This can result in a cost savings if there is much overdraw and "
|
||||
"if the pixel shader is particularly expensive, but in most cases "
|
||||
"it will result in a cost penalty."));
|
||||
"to fill the depth buffer before going back to draw pixels. "
|
||||
"This can result in a cost savings if there is much overdraw and "
|
||||
"if the pixel shader is particularly expensive, but in most cases "
|
||||
"it will result in a cost penalty."));
|
||||
|
||||
ConfigVariableInt speedtree_max_billboard_images_by_base
|
||||
("speedtree-max-billboard-images-by-base", 20,
|
||||
PRC_DESC("Specifies the maximum number of billboard images used by any single "
|
||||
"tree."));
|
||||
"tree."));
|
||||
|
||||
ConfigVariableDouble speedtree_visibility
|
||||
("speedtree-visibility", 1000.0,
|
||||
|
|
@ -96,12 +96,12 @@ ConfigVariableBool speedtree_transmission_lighting
|
|||
ConfigVariableBool speedtree_detail_layer
|
||||
("speedtree-detail-layer", false,
|
||||
PRC_DESC("True to render the detail texture layer defined on tree and "
|
||||
"terrain objects, false otherwise."));
|
||||
"terrain objects, false otherwise."));
|
||||
|
||||
ConfigVariableBool speedtree_detail_normal_mapping
|
||||
("speedtree-detail-normal-mapping", false,
|
||||
PRC_DESC("True to render the detail normal maps defined on tree and "
|
||||
"terrain objects, false otherwise."));
|
||||
"terrain objects, false otherwise."));
|
||||
|
||||
ConfigVariableBool speedtree_ambient_contrast
|
||||
("speedtree-ambient-contrast", false,
|
||||
|
|
@ -114,7 +114,7 @@ ConfigVariableDouble speedtree_transmission_scalar
|
|||
ConfigVariableDouble speedtree_fog_distance
|
||||
("speedtree-fog-distance", "2500 5000",
|
||||
PRC_DESC("Specifies the nearest and farthest distance of the fog on trees "
|
||||
"and terrain."));
|
||||
"and terrain."));
|
||||
|
||||
ConfigVariableDouble speedtree_fog_color
|
||||
("speedtree-fog-color", "1.0 1.0 1.0",
|
||||
|
|
@ -123,7 +123,7 @@ ConfigVariableDouble speedtree_fog_color
|
|||
ConfigVariableDouble speedtree_sky_color
|
||||
("speedtree-sky-color", "0.2 0.3 0.5",
|
||||
PRC_DESC("Specifies the r g b color of the SpeedTree sky, when the sky "
|
||||
"is enabled. Currently unused."));
|
||||
"is enabled. Currently unused."));
|
||||
|
||||
ConfigVariableDouble speedtree_sky_fog
|
||||
("speedtree-sky-fog", "-0.5 1.0",
|
||||
|
|
@ -132,7 +132,7 @@ ConfigVariableDouble speedtree_sky_fog
|
|||
ConfigVariableDouble speedtree_sun_color
|
||||
("speedtree-sun-color", "1.0 1.0 0.85",
|
||||
PRC_DESC("Specifies the r g b color of the SpeedTree sun, when the sun "
|
||||
"is enabled. Currently unused."));
|
||||
"is enabled. Currently unused."));
|
||||
|
||||
ConfigVariableDouble speedtree_sun_size
|
||||
("speedtree-sun-size", 0.001,
|
||||
|
|
@ -149,24 +149,24 @@ ConfigVariableDouble speedtree_sun_fog_bloom
|
|||
ConfigVariableDouble speedtree_specular_color
|
||||
("speedtree-specular-color", "1 1 1",
|
||||
PRC_DESC("Specifies the r g b color of the specular reflections on SpeedTree "
|
||||
"surfaces."));
|
||||
"surfaces."));
|
||||
|
||||
ConfigVariableDouble speedtree_emissive_color
|
||||
("speedtree-emissive-color", "0 0 0",
|
||||
PRC_DESC("Specifies the r g b color of the emissive light effect on SpeedTree "
|
||||
"surfaces."));
|
||||
"surfaces."));
|
||||
|
||||
ConfigVariableInt speedtree_shadow_map_resolution
|
||||
("speedtree-shadow-map-resolution", 0, //1024,
|
||||
PRC_DESC("Specifies the resolution for rendering shadow maps. Should "
|
||||
"be a power of 2. Specify 0 to disable shadowing in SpeedTree."));
|
||||
"be a power of 2. Specify 0 to disable shadowing in SpeedTree."));
|
||||
|
||||
ConfigVariableDouble speedtree_cascading_shadow_splits
|
||||
("speedtree-cascading-shadow-splits", "200 400 600",
|
||||
PRC_DESC("Specifies the shadow split distance, in spatial units, for "
|
||||
"each shadow map to be rendered. The number of values also "
|
||||
"implies the number of shadow maps, to a maximum value compiled "
|
||||
"within SpeedTree (typically 4)."));
|
||||
"each shadow map to be rendered. The number of values also "
|
||||
"implies the number of shadow maps, to a maximum value compiled "
|
||||
"within SpeedTree (typically 4)."));
|
||||
|
||||
ConfigVariableBool speedtree_smooth_shadows
|
||||
("speedtree-smooth-shadows", false,
|
||||
|
|
@ -187,66 +187,66 @@ ConfigVariableBool speedtree_frond_rippling
|
|||
ConfigVariableInt speedtree_terrain_num_lods
|
||||
("speedtree-terrain-num-lods", 5,
|
||||
PRC_DESC("Specifies the number of different LOD stages to use in "
|
||||
"rendering terrain. Each stage has 75% few polygons than the "
|
||||
"stage before. Increasing this number decreases the total "
|
||||
"number of polygons onscreen, at the cost of visual quality of "
|
||||
"distant terrain."));
|
||||
"rendering terrain. Each stage has 75% few polygons than the "
|
||||
"stage before. Increasing this number decreases the total "
|
||||
"number of polygons onscreen, at the cost of visual quality of "
|
||||
"distant terrain."));
|
||||
|
||||
ConfigVariableInt speedtree_terrain_resolution
|
||||
("speedtree-terrain-resolution", 33,
|
||||
PRC_DESC("Specifies the number of vertices per edge of each terrain grid "
|
||||
"cell at the highest LOD. This must be a power of two plus 1."));
|
||||
|
||||
"cell at the highest LOD. This must be a power of two plus 1."));
|
||||
|
||||
ConfigVariableInt speedtree_terrain_cell_size
|
||||
("speedtree-terrain-cell-size", 800,
|
||||
PRC_DESC("Specifies the size in spatial units of one edge of a terrain "
|
||||
"grid cell. This effects culling and resolution, but has nothing "
|
||||
"to do with the scale of the heightmap or other maps."));
|
||||
"grid cell. This effects culling and resolution, but has nothing "
|
||||
"to do with the scale of the heightmap or other maps."));
|
||||
|
||||
ConfigVariableDouble speedtree_shadow_fade
|
||||
("speedtree-shadow-fade", 0.25,
|
||||
PRC_DESC("Specifies the rate at which shadows fade to transparency in the "
|
||||
"distance."));
|
||||
"distance."));
|
||||
|
||||
ConfigVariableBool speedtree_show_overlays
|
||||
("speedtree-show-overlays", false,
|
||||
PRC_DESC("True to draw onscreen overlays showing the generated "
|
||||
"shadow map(s)."));
|
||||
"shadow map(s)."));
|
||||
|
||||
ConfigVariableInt speedtree_max_num_visible_cells
|
||||
("speedtree-max-num-visible-cells", 75,
|
||||
PRC_DESC("Specifies the maximum number of cells in a single SpeedTree forest "
|
||||
"frustum. This is used internally by SpeedTree's billboard system."));
|
||||
"frustum. This is used internally by SpeedTree's billboard system."));
|
||||
|
||||
ConfigVariableDouble speedtree_cull_cell_size
|
||||
("speedtree-cull-cell-size", 1200,
|
||||
PRC_DESC("Specifies the size of a single SpeedTree cull cell, in Panda "
|
||||
"units. Increasing this number decreases the number of "
|
||||
"individual calls that must be made to render geometry, "
|
||||
"while increasing the number of trees that are rendered "
|
||||
"per call."));
|
||||
"units. Increasing this number decreases the number of "
|
||||
"individual calls that must be made to render geometry, "
|
||||
"while increasing the number of trees that are rendered "
|
||||
"per call."));
|
||||
|
||||
ConfigVariableDouble speedtree_area_scale
|
||||
("speedtree-area-scale", 3280.839895013,
|
||||
PRC_DESC("This is the factor by which the \"area\" value in a SpeedTree "
|
||||
"terrain.txt file is scaled (after taking its square root) "
|
||||
"when loading a new terrain. The default is about 3281, which "
|
||||
"scales from kilometers to feet. You should set a different "
|
||||
"scale if you use units other than feet."));
|
||||
"terrain.txt file is scaled (after taking its square root) "
|
||||
"when loading a new terrain. The default is about 3281, which "
|
||||
"scales from kilometers to feet. You should set a different "
|
||||
"scale if you use units other than feet."));
|
||||
|
||||
ConfigVariableBool speedtree_follow_terrain
|
||||
("speedtree-follow-terrain", true,
|
||||
PRC_DESC("Set this true to have trees automatically snap to the terrain "
|
||||
"height when loaded into a SpeedTree node with a configured "
|
||||
"terrain. If this is false, you may still call "
|
||||
"SpeedTreeNode::snap_to_terrain() afterwards."));
|
||||
"height when loaded into a SpeedTree node with a configured "
|
||||
"terrain. If this is false, you may still call "
|
||||
"SpeedTreeNode::snap_to_terrain() afterwards."));
|
||||
|
||||
ConfigVariableInt speedtree_max_random_try_count
|
||||
("speedtree-max-random-try-count", 1000,
|
||||
PRC_DESC("This is a cheesy limit to detect bad parameters passed to "
|
||||
"SpeedTreeNode::add_random_instances(). If this number of attempts "
|
||||
"to find a legal place for a tree fail in a row, the parameters "
|
||||
"are deemed to be in error, and the function fails."));
|
||||
"SpeedTreeNode::add_random_instances(). If this number of attempts "
|
||||
"to find a legal place for a tree fail in a row, the parameters "
|
||||
"are deemed to be in error, and the function fails."));
|
||||
|
||||
ConfigVariableBool speedtree_5_2_stf
|
||||
("speedtree-5-2-stf",
|
||||
|
|
@ -256,8 +256,8 @@ ConfigVariableBool speedtree_5_2_stf
|
|||
false,
|
||||
#endif
|
||||
PRC_DESC("The format of the STF file changed in SpeedTree version 5.2. "
|
||||
"Specify true here to read STF files in the new file format, or "
|
||||
"false to read STF files in the pre-5.2 file format."));
|
||||
"Specify true here to read STF files in the new file format, or "
|
||||
"false to read STF files in the pre-5.2 file format."));
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -117,18 +117,18 @@ PUBLISHED:
|
|||
void add_instances_from(const SpeedTreeNode *other);
|
||||
void add_instances_from(const SpeedTreeNode *other, const TransformState *transform);
|
||||
void add_random_instances(const STTree *tree, int quantity,
|
||||
float x_min, float x_max,
|
||||
float y_min, float y_max,
|
||||
float scale_min, float scale_max,
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max,
|
||||
Randomizer &randomizer = Randomizer());
|
||||
float x_min, float x_max,
|
||||
float y_min, float y_max,
|
||||
float scale_min, float scale_max,
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max,
|
||||
Randomizer &randomizer = Randomizer());
|
||||
|
||||
bool add_from_stf(const Filename &stf_filename,
|
||||
const LoaderOptions &options = LoaderOptions());
|
||||
const LoaderOptions &options = LoaderOptions());
|
||||
bool add_from_stf(istream &in, const Filename &pathname,
|
||||
const LoaderOptions &options = LoaderOptions(),
|
||||
Loader *loader = NULL);
|
||||
const LoaderOptions &options = LoaderOptions(),
|
||||
Loader *loader = NULL);
|
||||
|
||||
bool setup_terrain(const Filename &terrain_file);
|
||||
void set_terrain(STTerrain *terrain);
|
||||
|
|
@ -180,7 +180,7 @@ protected:
|
|||
private:
|
||||
void init_node();
|
||||
void r_add_instances(PandaNode *node, const TransformState *transform,
|
||||
Thread *current_thread);
|
||||
Thread *current_thread);
|
||||
|
||||
void repopulate();
|
||||
void update_terrain_cells();
|
||||
|
|
@ -209,7 +209,7 @@ private:
|
|||
static void init_type() {
|
||||
CallbackObject::init_type();
|
||||
register_type(_type_handle, "SpeedTreeNode::DrawCallback",
|
||||
CallbackObject::get_class_type());
|
||||
CallbackObject::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ clear() {
|
|||
|
||||
CPT(GeomVertexFormat) format = GeomVertexFormat::register_format
|
||||
(new GeomVertexArrayFormat(InternalName::get_vertex(), 3,
|
||||
GeomEnums::NT_float32, GeomEnums::C_point,
|
||||
InternalName::get_texcoord(), 3,
|
||||
GeomEnums::NT_float32, GeomEnums::C_texcoord));
|
||||
GeomEnums::NT_float32, GeomEnums::C_point,
|
||||
InternalName::get_texcoord(), 3,
|
||||
GeomEnums::NT_float32, GeomEnums::C_texcoord));
|
||||
set_vertex_format(format);
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ setup_terrain(istream &in, const Filename &pathname) {
|
|||
float r, g, b;
|
||||
in >> r >> g >> b;
|
||||
if (!_splat_layers.empty()) {
|
||||
_splat_layers.back()._color.set(r, g, b, 1.0f);
|
||||
_splat_layers.back()._color.set(r, g, b, 1.0f);
|
||||
}
|
||||
|
||||
} else if (keyword == "ambient" || keyword == "diffuse" || keyword == "specular" || keyword == "emissive") {
|
||||
|
|
@ -200,7 +200,7 @@ setup_terrain(istream &in, const Filename &pathname) {
|
|||
|
||||
} else {
|
||||
speedtree_cat.error()
|
||||
<< "Invalid token " << keyword << " in " << pathname << "\n";
|
||||
<< "Invalid token " << keyword << " in " << pathname << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -319,8 +319,8 @@ get_slope(float x, float y) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void STBasicTerrain::
|
||||
fill_vertices(GeomVertexData *data,
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const {
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const {
|
||||
nassertv(data->get_format() == _vertex_format);
|
||||
GeomVertexWriter vertex(data, InternalName::get_vertex());
|
||||
GeomVertexWriter texcoord(data, InternalName::get_texcoord());
|
||||
|
|
@ -435,7 +435,7 @@ compute_slope(float smoothing) {
|
|||
slope *= (0.5f / MathNumbers::pi_f);
|
||||
|
||||
if (slope > 1.0f) {
|
||||
slope = 1.0f;
|
||||
slope = 1.0f;
|
||||
}
|
||||
_slope_data._data[i + j * width] = slope;
|
||||
}
|
||||
|
|
@ -454,37 +454,37 @@ compute_slope(float smoothing) {
|
|||
|
||||
// compute smoothed normals
|
||||
for (int i = 0; i < width; ++i) {
|
||||
int left = (i + width - 1) % width;
|
||||
int right = (i + 1) % width;
|
||||
int left = (i + width - 1) % width;
|
||||
int right = (i + 1) % width;
|
||||
|
||||
for (int j = 0; j < height; ++j) {
|
||||
int top = (j + height - 1) % height;
|
||||
int bottom = (j + 1) % height;
|
||||
for (int j = 0; j < height; ++j) {
|
||||
int top = (j + height - 1) % height;
|
||||
int bottom = (j + 1) % height;
|
||||
|
||||
smoothed[i + j * width] = (_slope_data._data[right + j * width] +
|
||||
_slope_data._data[left + j * width] +
|
||||
_slope_data._data[i + top * width] +
|
||||
_slope_data._data[i + bottom * width] +
|
||||
_slope_data._data[right + top * width] +
|
||||
_slope_data._data[right + bottom * width] +
|
||||
_slope_data._data[left + top * width] +
|
||||
_slope_data._data[left + bottom * width]);
|
||||
smoothed[i + j * width] *= 0.125f;
|
||||
}
|
||||
smoothed[i + j * width] = (_slope_data._data[right + j * width] +
|
||||
_slope_data._data[left + j * width] +
|
||||
_slope_data._data[i + top * width] +
|
||||
_slope_data._data[i + bottom * width] +
|
||||
_slope_data._data[right + top * width] +
|
||||
_slope_data._data[right + bottom * width] +
|
||||
_slope_data._data[left + top * width] +
|
||||
_slope_data._data[left + bottom * width]);
|
||||
smoothed[i + j * width] *= 0.125f;
|
||||
}
|
||||
}
|
||||
|
||||
// interpolate or set
|
||||
if (si == steps - 1) {
|
||||
// last step, interpolate
|
||||
for (int i = 0; i < width; ++i) {
|
||||
for (int j = 0; j < height; ++j) {
|
||||
_slope_data._data[i + j * width] = interpolate(_slope_data._data[i + j * width], smoothed[i + j * width], last_interpolation);
|
||||
}
|
||||
}
|
||||
// last step, interpolate
|
||||
for (int i = 0; i < width; ++i) {
|
||||
for (int j = 0; j < height; ++j) {
|
||||
_slope_data._data[i + j * width] = interpolate(_slope_data._data[i + j * width], smoothed[i + j * width], last_interpolation);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// full smoothing step, copy everything
|
||||
_slope_data = smoothing_data;
|
||||
// full smoothing step, copy everything
|
||||
_slope_data = smoothing_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ PUBLISHED:
|
|||
virtual float get_slope(float x, float y) const;
|
||||
|
||||
virtual void fill_vertices(GeomVertexData *data,
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const;
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
|
@ -63,7 +63,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void read_quoted_filename(Filename &result, istream &in,
|
||||
const Filename &dirname);
|
||||
const Filename &dirname);
|
||||
|
||||
protected:
|
||||
template<class ValueType>
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ get_slope(float x, float y) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool STTerrain::
|
||||
placement_is_acceptable(float x, float y,
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max) {
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max) {
|
||||
float height = get_height(x, y);
|
||||
if (height < height_min || height > height_max) {
|
||||
return false;
|
||||
|
|
@ -171,8 +171,8 @@ placement_is_acceptable(float x, float y,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void STTerrain::
|
||||
fill_vertices(GeomVertexData *data,
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const {
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -247,7 +247,7 @@ set_vertex_format(const GeomVertexFormat *format) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool STTerrain::
|
||||
convert_vertex_format(STTerrain::VertexAttribs &st_vertex_attribs,
|
||||
const GeomVertexFormat *format) {
|
||||
const GeomVertexFormat *format) {
|
||||
st_vertex_attribs.clear();
|
||||
|
||||
if (format->get_num_arrays() != 1) {
|
||||
|
|
@ -283,7 +283,7 @@ convert_vertex_format(STTerrain::VertexAttribs &st_vertex_attribs,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool STTerrain::
|
||||
convert_vertex_column(SpeedTree::SVertexAttribDesc &st_attrib,
|
||||
const GeomVertexColumn *column) {
|
||||
const GeomVertexColumn *column) {
|
||||
switch (column->get_numeric_type()) {
|
||||
case GeomEnums::NT_float32:
|
||||
st_attrib.m_eDataType = SpeedTree::VERTEX_ATTRIB_TYPE_FLOAT;
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ PUBLISHED:
|
|||
virtual float get_slope(float x, float y) const;
|
||||
|
||||
bool placement_is_acceptable(float x, float y,
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max);
|
||||
float height_min, float height_max,
|
||||
float slope_min, float slope_max);
|
||||
|
||||
virtual void fill_vertices(GeomVertexData *data,
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const;
|
||||
float start_x, float start_y,
|
||||
float size_xy, int num_xy) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
|
@ -84,9 +84,9 @@ protected:
|
|||
|
||||
typedef pvector<SpeedTree::SVertexAttribDesc> VertexAttribs;
|
||||
static bool convert_vertex_format(VertexAttribs &st_vertex_attribs,
|
||||
const GeomVertexFormat *format);
|
||||
const GeomVertexFormat *format);
|
||||
static bool convert_vertex_column(SpeedTree::SVertexAttribDesc &st_attrib,
|
||||
const GeomVertexColumn *column);
|
||||
const GeomVertexColumn *column);
|
||||
|
||||
protected:
|
||||
class SplatLayer {
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ operator SpeedTree::CInstance () const {
|
|||
INLINE STTransform::
|
||||
operator CPT(TransformState) () const {
|
||||
return TransformState::make_pos_hpr_scale(_pos,
|
||||
LVecBase3f(_rotate, 0.0f, 0.0f),
|
||||
LVecBase3f(_scale, _scale, _scale));
|
||||
LVecBase3f(_rotate, 0.0f, 0.0f),
|
||||
LVecBase3f(_scale, _scale, _scale));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ ConfigVariableDouble inactivity_timeout
|
|||
ConfigVariableBool trackball_use_alt_keys
|
||||
("trackball-use-alt-keys", true,
|
||||
PRC_DESC("Set this true to use the command and option/control keys in "
|
||||
"conjunction with the first mouse button to simulate the behavior of "
|
||||
"the second and third mouse buttons in trackball mode. Particularly "
|
||||
"useful for Macs, or laptops with limited mouse buttons."));
|
||||
"conjunction with the first mouse button to simulate the behavior of "
|
||||
"the second and third mouse buttons in trackball mode. Particularly "
|
||||
"useful for Macs, or laptops with limited mouse buttons."));
|
||||
|
||||
ConfigureFn(config_tform) {
|
||||
DriveInterface::init_type();
|
||||
|
|
|
|||
|
|
@ -2100,12 +2100,12 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||
|
||||
#ifdef PANDA_WIN7
|
||||
case WM_TOUCH:
|
||||
_numTouches = LOWORD(wparam);
|
||||
if(_numTouches > MAX_TOUCHES)
|
||||
_numTouches = MAX_TOUCHES;
|
||||
GetTouchInputInfo((HTOUCHINPUT)lparam, _numTouches, _touches, sizeof(TOUCHINPUT));
|
||||
CloseTouchInputHandle((HTOUCHINPUT)lparam);
|
||||
break;
|
||||
_numTouches = LOWORD(wparam);
|
||||
if(_numTouches > MAX_TOUCHES)
|
||||
_numTouches = MAX_TOUCHES;
|
||||
GetTouchInputInfo((HTOUCHINPUT)lparam, _numTouches, _touches, sizeof(TOUCHINPUT));
|
||||
CloseTouchInputHandle((HTOUCHINPUT)lparam);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "pandabase.h"
|
||||
#include "graphicsWindow.h"
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue