added basic ability to set the boid prim - no error checking yet

stable0711
Jon Cundill 2011-07-09 13:27:58 +01:00
parent 72db5e2cc8
commit f0176ce13f
2 changed files with 14 additions and 3 deletions

View File

@ -89,6 +89,7 @@ namespace Flocking
// init module // init module
m_model = new FlockingModel (); m_model = new FlockingModel ();
m_view = new FlockingView (m_scene); m_view = new FlockingView (m_scene);
m_view.BoidPrim = m_boidPrim;
} }
} }
@ -266,7 +267,12 @@ namespace Flocking
public void HandleSetPrimCmd (string module, string[] args) public void HandleSetPrimCmd (string module, string[] args)
{ {
if (ShouldHandleCmd ()) { if (ShouldHandleCmd ()) {
m_log.Info ("set prim not implemented yet"); //m_log.Info ("set prim not implemented yet");
string primName = args[1];
lock(m_sync) {
m_view.BoidPrim = primName;
m_view.Clear();
}
} }
} }

View File

@ -38,6 +38,7 @@ namespace Flocking
private Scene m_scene; private Scene m_scene;
private UUID m_owner; private UUID m_owner;
private String m_boidPrim;
private Dictionary<string, SceneObjectGroup> m_sogMap = new Dictionary<string, SceneObjectGroup> (); private Dictionary<string, SceneObjectGroup> m_sogMap = new Dictionary<string, SceneObjectGroup> ();
@ -50,6 +51,10 @@ namespace Flocking
{ {
m_owner = owner; m_owner = owner;
} }
public String BoidPrim {
set{ m_boidPrim = value;}
}
public void Clear () public void Clear ()
{ {
@ -75,7 +80,7 @@ namespace Flocking
SceneObjectGroup sog; SceneObjectGroup sog;
if (existing == null) { if (existing == null) {
SceneObjectGroup group = findByName ("boidPrim"); SceneObjectGroup group = findByName (m_boidPrim);
sog = CopyPrim (group, boid.Id); sog = CopyPrim (group, boid.Id);
m_sogMap [boid.Id] = sog; m_sogMap [boid.Id] = sog;
m_scene.AddNewSceneObject (sog, false); m_scene.AddNewSceneObject (sog, false);
@ -137,7 +142,7 @@ namespace Flocking
private SceneObjectGroup MakeDefaultPrim (string name) private SceneObjectGroup MakeDefaultPrim (string name)
{ {
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere (); PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere ();
shape.Scale = new Vector3 (0.5f, 0.5f, 2.5f); shape.Scale = new Vector3 (0.5f, 0.5f, 0.5f);
SceneObjectGroup prim = new SceneObjectGroup (m_owner, new Vector3 (128f, 128f, 25f), shape); SceneObjectGroup prim = new SceneObjectGroup (m_owner, new Vector3 (128f, 128f, 25f), shape);
prim.Name = name; prim.Name = name;