summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp27
-rw-r--r--indra/llplugin/llpluginclassmedia.h2
-rw-r--r--indra/media_plugins/webkit/media_plugin_webkit.cpp16
-rw-r--r--indra/newview/llviewermedia.cpp13
4 files changed, 55 insertions, 3 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index cc8fe53c3b..8f161201f4 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -474,6 +474,33 @@ void LLPluginClassMedia::jsAgentLocationEvent( double x, double y, double z )
sendMessage( message );
}
+void LLPluginClassMedia::jsAgentGlobalLocationEvent( double x, double y, double z )
+{
+ if( ! mPlugin || !mPlugin->isRunning() || mPlugin->isBlocked() )
+ {
+ return;
+ }
+
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "js_agent_global_location");
+ message.setValueReal( "x", x );
+ message.setValueReal( "y", y );
+ message.setValueReal( "z", z );
+ sendMessage( message );
+}
+
+void LLPluginClassMedia::jsAgentOrientationEvent( double angle )
+{
+ if( ! mPlugin || !mPlugin->isRunning() || mPlugin->isBlocked() )
+ {
+ return;
+ }
+
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "js_agent_orientation");
+ message.setValueReal( "angle", angle );
+
+ sendMessage( message );
+}
+
void LLPluginClassMedia::jsAgentLanguageEvent( const std::string& language )
{
if( ! mPlugin || !mPlugin->isRunning() || mPlugin->isBlocked() )
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 015fb31252..c061390699 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -122,6 +122,8 @@ public:
void jsExposeObjectEvent( bool expose );
void jsValuesValidEvent( bool valid );
void jsAgentLocationEvent( double x, double y, double z );
+ void jsAgentGlobalLocationEvent( double x, double y, double z );
+ void jsAgentOrientationEvent( double angle );
void jsAgentLanguageEvent( const std::string& language );
void jsAgentRegionEvent( const std::string& region_name );
void jsAgentMaturityEvent( const std::string& maturity );
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index bdfbde8494..27f3c7260e 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -1194,11 +1194,21 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
#endif
}
else
- if(message_name == "js_agent_language")
+ if(message_name == "js_agent_global_location")
{
#if LLQTWEBKIT_API_VERSION >= 9
- const std::string& language = message_in.getValue("language");
- LLQtWebKit::getInstance()->setAgentLanguage( language );
+ F32 x = message_in.getValueReal("x");
+ F32 y = message_in.getValueReal("y");
+ F32 z = message_in.getValueReal("z");
+ LLQtWebKit::getInstance()->setAgentGlobalLocation( x, y, z );
+#endif
+ }
+ else
+ if(message_name == "js_agent_orientation")
+ {
+#if LLQTWEBKIT_API_VERSION >= 9
+ F32 angle = message_in.getValueReal("angle");
+ LLQtWebKit::getInstance()->setAgentOrientation( angle );
#endif
}
else
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 2b9f32f6f5..c88c07942e 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2365,6 +2365,19 @@ void LLViewerMediaImpl::updateJavascriptObject()
double z = agent_pos.mV[ VZ ];
mMediaSource->jsAgentLocationEvent( x, y, z );
+ // current location within the grid
+ LLVector3d agent_pos_global = gAgent.getLastPositionGlobal();
+ double global_x = agent_pos_global.mdV[ VX ];
+ double global_y = agent_pos_global.mdV[ VY ];
+ double global_z = agent_pos_global.mdV[ VZ ];
+ mMediaSource->jsAgentGlobalLocationEvent( global_x, global_y, global_z );
+
+ // current agent orientation
+ double rotation = atan2( gAgent.getAtAxis().mV[VX], gAgent.getAtAxis().mV[VY] );
+ double angle = rotation * RAD_TO_DEG;
+ if ( angle < 0.0f ) angle = 360.0f + angle; // TODO: has to be a better way to get orientation!
+ mMediaSource->jsAgentOrientationEvent( angle );
+
// current region agent is in
std::string region_name("");
LLViewerRegion* region = gAgent.getRegion();