|
From: <sgv...@us...> - 2010-05-16 14:46:34
|
Revision: 198
http://simspark.svn.sourceforge.net/simspark/?rev=198&view=rev
Author: sgvandijk
Date: 2010-05-16 14:46:27 +0000 (Sun, 16 May 2010)
Log Message:
-----------
- Initial player selection stuff
Modified Paths:
--------------
branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg
branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp
branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h
branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp
branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h
branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp
branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h
branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp
branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h
branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb
branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb
branches/agentselection/spark/data/scripts/materials.rb
branches/agentselection/spark/lib/kerosin/inputserver/input.h
branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp
branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp
branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp
branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h
branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp
branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp
branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp
branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp
branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp
branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp
Modified: branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg
===================================================================
--- branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/data/rsg/agent/nao/nao.rsg 2010-05-16 14:46:27 UTC (rev 198)
@@ -68,6 +68,14 @@
(setName AgentState)
(nd GameStatePerceptor)
(nd HearPerceptor)
+ (nd Transform
+ (nd Sphere
+ (setName SelectionMarker)
+ (setRadius 0.2)
+ (setMaterial matRed)
+ (setTransparent)
+ )
+ )
)
(nd GyroRatePerceptor (setName torso))
Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -23,9 +23,11 @@
#include <soccertypes.h>
#include <soccerbase/soccerbase.h>
#include <gamestateaspect/gamestateaspect.h>
+#include <kerosin/renderserver/rendernode.h>
#include <sstream>
using namespace oxygen;
+using namespace kerosin;
using namespace std;
AgentState::AgentState() : ObjectState(), mTeamIndex(TI_NONE),
@@ -33,7 +35,8 @@
mHearMax(2), mHearInc(1),
mHearDecay(2), mHearMateCap(2),
mHearOppCap(2), mIfSelfMsg(false),
- mIfMateMsg(false), mIfOppMsg(false)
+ mIfMateMsg(false), mIfOppMsg(false),
+ mSelected(false)
{
// set mID and mUniformNumber into a joint state
SetUniformNumber(0);
@@ -211,6 +214,18 @@
}
void
+AgentState::UpdateHierarchyInternal()
+{
+ boost::shared_ptr<RenderNode> node = boost::shared_dynamic_cast<RenderNode>(GetChild("SelectionMarker", true));
+ if (!node)
+ {
+ GetLog()->Error() << "ERROR: (AgentState::UpdateHierarchyInternal) could not find selection marker\n";
+ return;
+ }
+ node->SetVisible(mSelected);
+}
+
+void
AgentState::OnUnlink()
{
ObjectState::OnUnlink();
Modified: branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccer/agentstate/agentstate.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -91,6 +91,10 @@
bool GetMessage(std::string& msg, float& direction, bool teamMate);
bool GetSelfMessage(std::string& msg);
+ bool IsSelected() const { return mSelected; }
+ void Select(bool s = true) { mSelected = s; }
+ void UnSelect() { mSelected = false; }
+
protected:
/** team index */
TTeamIndex mTeamIndex;
@@ -134,7 +138,9 @@
/** is there any message from oponnent */
bool mIfOppMsg;
+ bool mSelected;
protected:
+ virtual void UpdateHierarchyInternal();
virtual void OnUnlink();
};
Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -212,6 +212,47 @@
}
void
+SoccerRuleAspect::ClearSelectedPlayers(float min_dist)
+{
+ std::list<boost::shared_ptr<AgentState> > agent_states;
+ if (! SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE))
+ return;
+
+ boost::shared_ptr<oxygen::Transform> agent_aspect;
+ std::list<boost::shared_ptr<AgentState> >::const_iterator i;
+ for (i = agent_states.begin(); i != agent_states.end(); ++i)
+ {
+ SoccerBase::GetTransformParent(**i, agent_aspect);
+
+ // if agent is selected, move it away
+ Vector3f new_pos = agent_aspect->GetWorldTransform().Pos();
+
+ if ((*i)->IsSelected())
+ {
+ float dist = salt::UniformRNG<>(min_dist, min_dist + 2.0)();
+
+ if ((*i)->GetTeamIndex() == TI_LEFT)
+ {
+ if (new_pos[0] - dist < -mFieldLength/2.0)
+ {
+ new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist;
+ } else {
+ new_pos[0] = new_pos[0] - dist;
+ }
+ } else {
+ if (new_pos[0] + dist > mFieldLength/2.0)
+ {
+ new_pos[1] = new_pos[1] < 0 ? new_pos[1] + dist : new_pos[1] - dist;
+ } else {
+ new_pos[0] = new_pos[0] + dist;
+ }
+ }
+ SoccerBase::MoveAgent(agent_aspect, new_pos);
+ }
+ }
+}
+
+void
SoccerRuleAspect::DropBall()
{
DropBall(mBallBody->GetPosition());
@@ -1348,7 +1389,51 @@
}
}
-Vector2f SoccerRuleAspect::GetFieldSize() const
+Vector2f
+SoccerRuleAspect::GetFieldSize() const
{
return Vector2f(mFieldLength,mFieldWidth);
}
+
+void
+SoccerRuleAspect::ResetAgentSelection()
+{
+ std::list<boost::shared_ptr<AgentState> > agent_states;
+ if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE))
+ {
+
+ std::list<boost::shared_ptr<AgentState> >::const_iterator i;
+ for (i = agent_states.begin(); i != agent_states.end(); ++i)
+ (*i)->UnSelect();
+ }
+}
+
+void
+SoccerRuleAspect::SelectNextAgent()
+{
+ std::list<boost::shared_ptr<AgentState> > agent_states;
+ boost::shared_ptr<AgentState> first = agent_states.front();
+ bool found = false;
+ if (SoccerBase::GetAgentStates(*mBallState.get(), agent_states, TI_NONE))
+ {
+
+ std::list<boost::shared_ptr<AgentState> >::const_iterator i;
+ for (i = agent_states.begin(); i != agent_states.end(); ++i)
+ {
+ if ((*i)->IsSelected())
+ {
+ (*i)->UnSelect();
+ found = true;
+ continue;
+ }
+ if (found)
+ {
+ (*i)->Select();
+ found = false;
+ break;
+ }
+ }
+ if (found)
+ first->Select();
+ }
+}
\ No newline at end of file
Modified: branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccer/soccerruleaspect/soccerruleaspect.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -45,7 +45,8 @@
{
public:
typedef std::list<boost::shared_ptr<AgentState> > TAgentStateList;
-
+ typedef std::pair<TTeamIndex, int> TAgentSelection;
+
public:
SoccerRuleAspect();
virtual ~SoccerRuleAspect();
@@ -96,6 +97,10 @@
*/
salt::Vector2f GetFieldSize() const;
+ void ResetAgentSelection();
+
+ void SelectNextAgent();
+
protected:
/** rereads the current soccer script values */
virtual void UpdateCachedInternal();
@@ -191,6 +196,8 @@
*/
void ClearPlayersBeforeKickOff(TTeamIndex idx);
+ void ClearSelectedPlayers(float min_dist);
+
protected:
/** reference to the body node of the Ball */
boost::shared_ptr<oxygen::RigidBody> mBallBody;
Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -28,9 +28,11 @@
using namespace zeitgeist;
using namespace oxygen;
using namespace kerosin;
+using namespace std;
SoccerInput::SoccerInput()
- : InputItem()
+ : InputItem(),
+ mCmdMode(CmdModeDefault)
{
}
@@ -57,7 +59,10 @@
//JAN
scriptServer->CreateVariable("Command.FreeKickLeft", CmdFreeKickLeft);
scriptServer->CreateVariable("Command.FreeKickRight", CmdFreeKickRight);
+
+ scriptServer->CreateVariable("Command.NextMode", CmdNextMode);
+
mMonitorClient = shared_dynamic_cast<NetClient>
(GetCore()->Get("/sys/server/simulation/SparkMonitorClient"));
@@ -126,6 +131,15 @@
default:
return;
+ case CmdNextMode:
+ if (input.GetKeyPress())
+ {
+ mCmdMode = (ECmdMode)(mCmdMode + 1);
+ if (mCmdMode == CmdModeNone)
+ mCmdMode = CmdModeDefault;
+ }
+ break;
+
case CmdKickOff:
if (input.GetKeyPress())
{
Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerinput.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -51,8 +51,17 @@
CmdCameraRightGoal = CmdCameraRightCorner + 1,
//JAN
CmdFreeKickLeft = CmdCameraRightGoal + 1,
- CmdFreeKickRight = CmdFreeKickLeft + 1
+ CmdFreeKickRight = CmdFreeKickLeft + 1,
+
+ CmdNextMode = CmdFreeKickRight + 1
};
+
+ enum ECmdMode
+ {
+ CmdModeDefault = 1,
+ CmdModePlayerSelect,
+ CmdModeNone
+ };
public:
SoccerInput();
@@ -71,6 +80,8 @@
/** reset SparkMonitorClient reference */
virtual void OnUnlink();
+ ECmdMode GetCmdMode() const { return mCmdMode; }
+
protected:
void SendCommand(const std::string& cmd);
@@ -82,6 +93,8 @@
boost::shared_ptr<oxygen::RigidBody> mCameraBody;
boost::shared_ptr<oxygen::FPSController> mFPS;
+
+ ECmdMode mCmdMode;
};
DECLARE_CLASS(SoccerInput);
Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -23,6 +23,7 @@
#include <sstream>
#include "soccerrender.h"
#include "soccermonitor.h"
+#include "soccerinput.h"
#include <zeitgeist/logserver/logserver.h>
#include <kerosin/openglserver/openglserver.h>
#include <kerosin/fontserver/fontserver.h>
@@ -69,6 +70,13 @@
{
GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerMonitor\n";
}
+ mInput = shared_static_cast<SoccerInput>
+ (GetCore()->Get("/sys/server/simulation/InputControl/SoccerInput"));
+
+ if (mInput.get() == 0)
+ {
+ GetLog()->Error() << "ERROR: (SoccerRender) Unable to get SoccerInput\n";
+ }
}
void SoccerRender::OnUnlink()
@@ -90,7 +98,7 @@
return;
}
- stringstream ss_l, ss_c, ss_r;
+ stringstream ss_l, ss_c, ss_r, ss_m;
ss_c.setf(ios_base::fixed,ios_base::floatfield);
ss_c.precision(2);
@@ -141,5 +149,8 @@
xPos = int((1024-(mFont->GetStringWidth(ss_c.str().c_str())))/2);
mFont->DrawString(xPos, 0, ss_c.str().c_str());
+ ss_m << mInput->GetCmdMode();
+ mFont->DrawString(10, 30, ss_m.str().c_str());
+
mFontServer->End();
}
Modified: branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h
===================================================================
--- branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/plugin/soccermonitor/soccerrender.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -32,6 +32,7 @@
}
class SoccerMonitor;
+class SoccerInput;
class SoccerRender : public kerosin::CustomRender
{
@@ -51,6 +52,7 @@
boost::shared_ptr<SoccerMonitor> mMonitor;
boost::shared_ptr<kerosin::FontServer> mFontServer;
boost::shared_ptr<kerosin::Font> mFont;
+ boost::shared_ptr<SoccerInput> mInput;
};
DECLARE_CLASS(SoccerRender);
Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb
===================================================================
--- branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccerbindings.rb 2010-05-16 14:46:27 UTC (rev 198)
@@ -27,7 +27,7 @@
inputServer.bindCommand('k', Command.KickOff);
inputServer.bindCommand('j', Command.KickOffRight);
inputServer.bindCommand('b', Command.DropBall);
- inputServer.bindCommand('m', Command.MoveAgent);
+ #inputServer.bindCommand('m', Command.MoveAgent);
inputServer.bindCommand('n', Command.ShootBall);
inputServer.bindCommand('x', Command.MoveBall);
inputServer.bindCommand('1', Command.CameraLeftGoal);
@@ -39,5 +39,6 @@
inputServer.bindCommand('7', Command.CameraRightGoal);
inputServer.bindCommand('l', Command.FreeKickLeft);
inputServer.bindCommand('r', Command.FreeKickRight);
+ inputServer.bindCommand('lctrl y', Command.NextMode);
end
end
Modified: branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb
===================================================================
--- branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/rcssserver3d/rcssmonitor3d/soccersim-monitor.rb 2010-05-16 14:46:27 UTC (rev 198)
@@ -13,10 +13,6 @@
# state
sparkRegisterCustomMonitor 'SoccerMonitor'
-# register the soccer render plugin to draw the game state on the
-# screen
-sparkRegisterCustomRender 'SoccerRender'
-
if ($logPlayerMode == true)
# register the soccer input logplayer plugin for playback
# specific keys
@@ -29,3 +25,7 @@
# bind keys to soccer commands
run "soccerbindings.rb"
+# register the soccer render plugin to draw the game state on the
+# screen
+sparkRegisterCustomRender 'SoccerRender'
+
Modified: branches/agentselection/spark/data/scripts/materials.rb
===================================================================
--- branches/agentselection/spark/data/scripts/materials.rb 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/data/scripts/materials.rb 2010-05-16 14:46:27 UTC (rev 198)
@@ -13,7 +13,8 @@
material.setDiffuse(1.0,0.3,0.0,1.0)
material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRed');
-material.setDiffuse(1.0,0.0,0.0,1.0)
+material.setDiffuse(1.0,0.0,0.0,0.5)
+material.setAmbient(1.0,0.0,0.0,0.5)
material = sparkCreate('kerosin/MaterialSolid', $serverPath+'material/matRedGlow');
material.setDiffuse(1.0,0.0,0.0,1.0)
Modified: branches/agentselection/spark/lib/kerosin/inputserver/input.h
===================================================================
--- branches/agentselection/spark/lib/kerosin/inputserver/input.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/inputserver/input.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -101,6 +101,7 @@
float f;
} mData;
+ unsigned int mModState;
public:
// numbers
Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/inputserver/inputcontrol.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -212,21 +212,21 @@
break;
default:
- // pass unknown events on to the registered InputItems
- TLeafList items;
- ListChildrenSupportingClass<InputItem>(items);
-
- for (
- TLeafList::iterator iter = items.begin();
- iter != items.end();
- ++iter
- )
- {
- shared_static_cast<InputItem>(*iter)
- ->ProcessInput(input);
- }
break;
}
+ // pass unknown events on to the registered InputItems
+ TLeafList items;
+ ListChildrenSupportingClass<InputItem>(items);
+
+ for (
+ TLeafList::iterator iter = items.begin();
+ iter != items.end();
+ ++iter
+ )
+ {
+ shared_static_cast<InputItem>(*iter)
+ ->ProcessInput(input);
+ }
}
if (mAdvanceTime)
Modified: branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/inputserver/inputserver.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -305,11 +305,13 @@
++bindIter
)
{
+ /*
const Bind& bind = (*bindIter);
//printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier);
- if (bind.modifier == mModifierState)
+ if (bind.modifier == input.mModState)
{
+ */
#if 0
if (input.mType == Input::eButton)
{
@@ -322,8 +324,8 @@
//printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier);
if (
- (bind.modifier == 0 && mModifierState == 0) ||
- (bind.modifier & mModifierState)
+ (bind.modifier == 0 && input.mModState == 0) ||
+ (bind.modifier & input.mModState)
)
#endif
{
@@ -335,7 +337,7 @@
input.mId = bind.cmd;
return true;
}
- }
+ //}
}
input.mId = -1;
@@ -404,6 +406,7 @@
{
current = tokens.front();
tokens.pop_front();
+
bind.modifier |= ParseModifier(current);
}
Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -24,10 +24,12 @@
#include "rendernode.h"
using namespace kerosin;
+using namespace std;
RenderNode::RenderNode()
: BaseNode(),
- mTransparent(false)
+ mTransparent(false),
+ mVisible(true)
{
}
@@ -37,5 +39,10 @@
void RenderNode::SetTransparent()
{
- mTransparent = true;
+ mTransparent = true;
}
+
+void RenderNode::SetVisible(bool visible)
+{
+ mVisible = visible;
+}
\ No newline at end of file
Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h
===================================================================
--- branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode.h 2010-05-16 14:46:27 UTC (rev 198)
@@ -45,8 +45,13 @@
bool IsTransparent() { return mTransparent; }
void SetTransparent();
+
+ void SetVisible(bool visible);
+ bool IsVisible() { return mVisible; }
+
private:
bool mTransparent;
+ bool mVisible;
};
DECLARE_ABSTRACTCLASS(RenderNode);
Modified: branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/renderserver/rendernode_c.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -29,8 +29,26 @@
return true;
}
+FUNCTION(RenderNode,setVisible)
+{
+ int visible;
+
+ if (
+ (in.GetSize() != 1) ||
+ (! in.GetValue(in.begin(), visible))
+ )
+ {
+ return false;
+ }
+
+
+ obj->SetVisible(visible);
+ return true;
+}
+
void CLASS(RenderNode)::DefineClass()
{
DEFINE_BASECLASS(oxygen/BaseNode);
DEFINE_FUNCTION(setTransparent);
+ DEFINE_FUNCTION(setVisible);
}
Modified: branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/renderserver/renderserver.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -251,6 +251,10 @@
{
boost::shared_ptr<RenderNode> renderNode = shared_dynamic_cast<RenderNode>(node);
if (renderNode.get() != 0 &&
+ !renderNode->IsVisible())
+ return;
+
+ if (renderNode.get() != 0 &&
((pass == 0 && !renderNode->IsTransparent()) || (pass == 1 && renderNode->IsTransparent()))
)
{
Modified: branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/sceneserver/singlematnode_c.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -40,10 +40,28 @@
return obj->SetMaterial(inName);
}
+FUNCTION(SingleMatNode,setVisible)
+{
+ int visible;
+
+ if (
+ (in.GetSize() != 1) ||
+ (! in.GetValue(in.begin(), visible))
+ )
+ {
+ return false;
+ }
+
+
+ obj->SetVisible(visible);
+ return true;
+}
+
void CLASS(SingleMatNode)::DefineClass()
{
DEFINE_BASECLASS(kerosin/StaticMesh);
DEFINE_FUNCTION(setMaterial);
+ DEFINE_FUNCTION(setVisible);
}
Modified: branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp
===================================================================
--- branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/lib/kerosin/sceneserver/staticmesh_c.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -144,15 +144,9 @@
return true;
}
-FUNCTION(RenderNode,setTransparent)
-{
- obj->SetTransparent();
- return true;
-}
-
void CLASS(StaticMesh)::DefineClass()
{
- DEFINE_BASECLASS(oxygen/BaseNode);
+ DEFINE_BASECLASS(kerosin/RenderNode);
DEFINE_FUNCTION(load);
DEFINE_FUNCTION(setScale);
DEFINE_FUNCTION(setCastShadows)
@@ -160,5 +154,4 @@
DEFINE_FUNCTION(setExternalMeshName)
DEFINE_FUNCTION(setExternalMeshScale)
DEFINE_FUNCTION(resetMaterials)
- DEFINE_FUNCTION(setTransparent);
}
Modified: branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp
===================================================================
--- branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/plugin/inputsdl/keyboardsdl.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -24,6 +24,7 @@
#include <zeitgeist/logserver/logserver.h>
using namespace kerosin;
+using namespace std;
KeyboardSDL::KeyboardSDL()
: InputDeviceSDL()
@@ -213,8 +214,7 @@
return 1;
}
- unsigned int& modState =
- mInputSystem->GetInputServer()->GetModifierState();
+ unsigned int modState;
modState = Input::eNone;
@@ -238,6 +238,16 @@
modState |= Input::eRAlt;
}
+ if (event->key.keysym.mod & KMOD_LCTRL)
+ {
+ modState |= Input::eLCtrl;
+ }
+
+ if (event->key.keysym.mod & KMOD_RCTRL)
+ {
+ modState |= Input::eRCtrl;
+ }
+
if (event->key.keysym.sym == 0)
{
return 1;
@@ -254,7 +264,8 @@
Input input(Input::eButton, sym);
input.mData.l = (event->type == SDL_KEYDOWN);
- mInputSystem->AddInputInternal(input);
+ input.mModState = modState;
+ mInputSystem->AddInput(input);
return 0;
}
Modified: branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp
===================================================================
--- branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-12 20:39:17 UTC (rev 197)
+++ branches/agentselection/spark/plugin/sparkmonitor/sparkmonitor.cpp 2010-05-16 14:46:27 UTC (rev 198)
@@ -233,11 +233,6 @@
void SparkMonitor::DescribeMesh(stringstream& ss, boost::shared_ptr<StaticMesh> mesh)
{
- if (! mFullState)
- {
- return DescribeBaseNode(ss);
- }
-
boost::shared_ptr<SingleMatNode> singleMat =
shared_dynamic_cast<SingleMatNode>(mesh);
@@ -249,6 +244,18 @@
ss << "(nd StaticMesh";
}
+ if (mesh->IsVisible())
+ {
+ ss << " (setVisible 1)";
+ }
+ else
+ {
+ ss << " (setVisible 0)";
+ }
+
+ if (! mFullState)
+ return;
+
if (mesh->IsTransparent())
{
ss << " (setTransparent)";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|