Package com.ngt.jopenmetaverse.shared.protocol.primitives

Examples of com.ngt.jopenmetaverse.shared.protocol.primitives.Primitive


        boolean isNewObject;
        //                          lock (simulator.ObjectsPrimitives.Dictionary)
        isNewObject = !simulator.ObjectsPrimitives.containsKey(block.ID);

        final Primitive prim = GetPrimitive(simulator, block.ID, block.FullID);

        // Textures
        objectupdate.Textures = new TextureEntry(block.TextureEntry, 0,
            block.TextureEntry.length);

        onObjectDataBlockUpdate.raiseEvent(new ObjectDataBlockUpdateEventArgs(simulator, prim, data, block, objectupdate, nameValues));

        //region Update Prim Info with decoded data
        prim.Flags = block.UpdateFlags;
        //JLogger.debug("Block UpdateFlags: " + block.UpdateFlags + Utils.bytesToHexDebugString(Utils.int64ToBytes(block.UpdateFlags), ""));
       
        if ((prim.Flags & PrimFlags.ZlibCompressed.getIndex()) != 0)
        {
          JLogger.warn("Got a ZlibCompressed ObjectUpdate, implement me!");
          continue;
        }

        // Automatically request ObjectProperties for prim if it was rezzed selected.
        if (( prim.Flags & PrimFlags.CreateSelected.getIndex()) != 0)
        {
          SelectObject(simulator, prim.LocalID);
        }

        prim.NameValues = nameValues;
        prim.LocalID = block.ID;
        prim.ID = block.FullID;
        prim.ParentID = block.ParentID;
        prim.RegionHandle = update.RegionData.RegionHandle;
        prim.Scale = block.Scale;
        prim.ClickAction = ClickAction.get(block.ClickAction);
        prim.OwnerID = block.OwnerID;
        prim.MediaURL = Utils.bytesWithTrailingNullByteToString(block.MediaURL);
        prim.Text = Utils.bytesWithTrailingNullByteToString(block.Text);
        prim.TextColor = new Color4(block.TextColor, 0, false, true);
        prim.IsAttachment = attachment;

        // Sound information
        prim.Sound = block.Sound;
        prim.SoundFlags = block.Flags;
        prim.SoundGain = block.Gain;
        prim.SoundRadius = block.Radius;

        // Joint information
        prim.Joint = JointType.get(block.JointType);
        prim.JointPivot = block.JointPivot;
        prim.JointAxisOrAnchor = block.JointAxisOrAnchor;

        // Object parameters
        prim.PrimData = data;

        // Textures, texture animations, particle system, and extra params
        prim.Textures = objectupdate.Textures;

        prim.TextureAnim = new TextureAnimation(block.TextureAnim, 0);
       
        //FIXME need to fix the following exception
        try{
          prim.ParticleSys = new ParticleSystem(block.PSBlock, 0);
        }
        catch(Exception ex)
        {
          JLogger.warn("Error while decoding ParticleSystem from packet: "
              + Utils.getExceptionStackTraceAsString(ex));
        }
       
        prim.SetExtraParamsFromBytes(block.ExtraParams, 0);

        // PCode-specific data
        switch (pcode)
        {
        case Grass:
View Full Code Here


        if (block.TextureEntry.length != 0)
          update.Textures = new TextureEntry(block.TextureEntry, 4, block.TextureEntry.length - 4);

        //endregion Decode update data
       
        final Primitive obj = !Client.settings.OBJECT_TRACKING ? null : (update.Avatar) ?
            (Primitive)GetAvatar(simulator, update.LocalID, UUID.Zero) :
              (Primitive)GetPrimitive(simulator, update.LocalID, UUID.Zero);

            // Fire the pre-emptive notice (before we stomp the object)
            //                        EventHandler<TerseObjectUpdateEventArgs> handler = m_TerseObjectUpdate;
View Full Code Here

        boolean isNew;
        //                        lock (simulator.ObjectsPrimitives.Dictionary)
        isNew = simulator.ObjectsPrimitives.containsKey(LocalID);

        Primitive prim = GetPrimitive(simulator, LocalID, FullID);

        prim.LocalID = LocalID;
        prim.ID = FullID;
        prim.Flags = block.UpdateFlags;
        prim.PrimData.PCode = pcode;

        //region Decode block and update Prim

        // State
        prim.PrimData.State = block.Data[i++];
        // CRC
        i += 4;
        // Material
        prim.PrimData.Material = Material.get(block.Data[i++]);
        // Click action
        prim.ClickAction = ClickAction.get(block.Data[i++]);
        // Scale
        prim.Scale = new Vector3(block.Data, i);
        i += 12;
        // Position
        prim.Position = new Vector3(block.Data, i);
        i += 12;
        // Rotation
        prim.Rotation = new Quaternion(block.Data, i, true);
        i += 12;
        // Compressed flags
        //EnumSet<CompressedFlags>
        long flags = Utils.bytesToUIntLit(block.Data, i);
        i += 4;

        prim.OwnerID = new UUID(block.Data, i);
        i += 16;

        // Angular velocity
        if ((flags & CompressedFlags.HasAngularVelocity.getIndex()) != 0)
        {
          prim.AngularVelocity = new Vector3(block.Data, i);
          i += 12;
        }

        // Parent ID
        if ((flags & CompressedFlags.HasParent.getIndex()) != 0)
        {
          //                            prim.ParentID = (uint)(block.Data[i++] + (block.Data[i++] << 8) +
          //                            (block.Data[i++] << 16) + (block.Data[i++] << 24));
          prim.ParentID = Utils.bytesToUIntLit(block.Data, i); i += 4;
        }
        else
        {
          prim.ParentID = 0;
        }

        // Tree data
        if ((flags & CompressedFlags.Tree.getIndex()) != 0)
        {
          prim.TreeSpecies = Tree.get(block.Data[i++]);
          //prim.ScratchPad = Utils.EmptyBytes;
        }
        // Scratch pad
        else if ((flags & CompressedFlags.ScratchPad.getIndex()) != 0)
        {
          prim.TreeSpecies = Tree.get((byte)0);

          int size = block.Data[i++];
          //prim.ScratchPad = new byte[size];
          //Buffer.BlockCopy(block.Data, i, prim.ScratchPad, 0, size);
          i += size;
        }
        prim.ScratchPad = Utils.EmptyBytes;

        // Floating text
        if ((flags & CompressedFlags.HasText.getIndex())  != 0)
        {
          String text = "";
          while (block.Data[i] != 0)
          {
            text += (char)block.Data[i];
            i++;
          }
          i++;

          // Floating text
          prim.Text = text;

          // Text color
          prim.TextColor = new Color4(block.Data, i, false);
          i += 4;
        }
        else
        {
          prim.Text = "";
        }

        // Media URL
        if ((flags & CompressedFlags.MediaURL.getIndex())  != 0)
        {
          String text = "";
          while (block.Data[i] != 0)
          {
            text += (char)block.Data[i];
            i++;
          }
          i++;

          prim.MediaURL = text;
        }

        // Particle system
        if ((flags & CompressedFlags.HasParticles.getIndex())  != 0)
        {
          prim.ParticleSys = new ParticleSystem(block.Data, i);
          i += 86;
        }

        // Extra parameters
        i += prim.SetExtraParamsFromBytes(block.Data, i);

        //Sound data
        if ((flags & CompressedFlags.HasSound.getIndex())  != 0)
        {
          prim.Sound = new UUID(block.Data, i);
View Full Code Here

//            }
//          }
//            });
//        findPrim = primarray[0];

        Primitive findPrim = simulator.ObjectsPrimitives.get(props.ObjectID);
       
        if (findPrim != null)
        {
          onObjectPropertiesUpdated.raiseEvent(new ObjectPropertiesUpdatedEventArgs(simulator, findPrim, props));
View Full Code Here

//          }
//        }
//          });
//      findPrim = primarray[0];

      Primitive findPrim = simulator.ObjectsPrimitives.get(op.ObjectData.ObjectID);
     
      if (findPrim != null)
      {
        synchronized (simulator.ObjectsPrimitives.getDictionary())
        {
View Full Code Here

    if (Client.settings.OBJECT_TRACKING)
    {
      synchronized (simulator.ObjectsPrimitives.getDictionary())
      {

        Primitive prim;

        if ((prim = simulator.ObjectsPrimitives.get(localID))!=null)
        {
          return prim;
        }
        else
        {
          prim = new Primitive();
          prim.LocalID = localID;
          prim.ID = fullID;
          prim.RegionHandle = simulator.Handle;

          simulator.ObjectsPrimitives.add(localID, prim);

          return prim;
        }
      }
    }
    else
    {
      return new Primitive();
    }
  }
View Full Code Here

        // Iterate through all of this sims primitives
        sim.ObjectsPrimitives.foreach(new Action<Entry<Long, Primitive>>()
            {
          public void execute(Entry<Long, Primitive> e)
          {
            Primitive prim = e.getValue();
            if (prim.Joint.equals(JointType.Invalid))
            {
              //region Angular Velocity
              Vector3 angVel = prim.AngularVelocity;
              float omega = angVel.lengthSquared();
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.protocol.primitives.Primitive

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.