当前位置: 首页>>代码示例>>C#>>正文


C# Primitive.TextureEntry类代码示例

本文整理汇总了C#中OpenMetaverse.Primitive.TextureEntry的典型用法代码示例。如果您正苦于以下问题:C# Primitive.TextureEntry类的具体用法?C# Primitive.TextureEntry怎么用?C# Primitive.TextureEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Primitive.TextureEntry类属于OpenMetaverse命名空间,在下文中一共展示了Primitive.TextureEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestCreate

        public void TestCreate()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");

            AvatarFactoryModule afm = new AvatarFactoryModule();
            TestScene scene = SceneSetupHelpers.SetupScene();
            SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule());
            TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1));
//            ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);

            // 8 is the index of the first baked texture in AvatarAppearance
            UUID originalFace8TextureId = TestHelper.ParseTail(0x10);
            Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
            Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
            originalTef.TextureID = originalFace8TextureId;

            // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
            // ScenePresence.SendInitialData() to reset our entire appearance.
            scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId));

            afm.SetAppearance(originalClient, originalTe, null);

            INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
            UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId);

            ScenePresence npc = scene.GetScenePresence(npcId);

            Assert.That(npc, Is.Not.Null);
            Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
        }
开发者ID:HGExchange,项目名称:opensim,代码行数:35,代码来源:NPCModuleTests.cs

示例2: AvatarAppearanceTest

        public void AvatarAppearanceTest()
        {
            Primitive.TextureEntry textures = new Primitive.TextureEntry(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
            byte[] visualParams = new byte[218];
            rand.NextBytes(visualParams);

            UUID receivedAgentID = UUID.Zero;
            Primitive.TextureEntry receivedTextureEntry = null;
            byte[] receivedVisualParams = null;

            AutoResetEvent callbackEvent = new AutoResetEvent(false);
            OutgoingPacketCallback callback = new OutgoingPacketCallback(
                delegate(Packet packet, UUID agentID, PacketCategory category)
                {
                    if (packet is AvatarAppearancePacket)
                    {
                        AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;

                        receivedAgentID = appearance.Sender.ID;
                        receivedTextureEntry = new Primitive.TextureEntry(appearance.ObjectData.TextureEntry, 0, appearance.ObjectData.TextureEntry.Length);
                        receivedVisualParams = new byte[appearance.VisualParam.Length];
                        for (int i = 0; i < receivedVisualParams.Length; i++)
                            receivedVisualParams[i] = appearance.VisualParam[i].ParamValue;

                        callbackEvent.Set();
                    }

                    return false;
                }
            );

            simian.Scenes[0].UDP.OnOutgoingPacket += callback;
            simian.Scenes[0].AgentAppearance(this, agent, textures, visualParams);

            Assert.IsTrue(callbackEvent.WaitOne(1000, false), "Timed out waiting for callback");
            simian.Scenes[0].UDP.OnOutgoingPacket -= callback;
            
            Assert.That(receivedAgentID == agent.ID, "Agent ID mismatch");
            
            Assert.That(receivedVisualParams.Length == 218, "VisualParams has an incorrect length");
            for (int i = 0; i < 218; i++)
                Assert.That(receivedVisualParams[i] == visualParams[i], "VisualParam mismatch at position " + i);

            Assert.That(receivedTextureEntry.DefaultTexture.TextureID == textures.DefaultTexture.TextureID, "Default texture mismatch");
            for (int i = 0; i < receivedTextureEntry.FaceTextures.Length; i++)
            {
                Assert.That(
                    (receivedTextureEntry.FaceTextures[i] == null && textures.FaceTextures[i] == null) ||
                    (receivedTextureEntry.FaceTextures[i].TextureID == textures.FaceTextures[i].TextureID), "TextureEntry mismatch at position " + i);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:51,代码来源:SceneManagerTests.cs

示例3: TestSetAppearance

        public void TestSetAppearance()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            UUID userId = TestHelpers.ParseTail(0x1);
            UUID bakedTextureID = TestHelpers.ParseTail(0x2);

            // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
            // to the AssetService, which will then store temporary and local assets permanently
            CoreAssetCache assetCache = new CoreAssetCache();
            
            AvatarFactoryModule afm = new AvatarFactoryModule();
            TestScene scene = new SceneHelpers(assetCache).SetupScene();
            SceneHelpers.SetupSceneModules(scene, afm);
            ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);

            // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules
            AssetBase bakedTextureAsset;
            bakedTextureAsset 
                = new AssetBase(
                    bakedTextureID, "Test Baked Texture", (sbyte)AssetType.Texture, userId.ToString());
            bakedTextureAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet
            bakedTextureAsset.Temporary = true;
            bakedTextureAsset.Local = true;
            scene.AssetService.Store(bakedTextureAsset);

            byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
            for (byte i = 0; i < visualParams.Length; i++)
                visualParams[i] = i;

            Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
            uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
            Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);

            int rebakeRequestsReceived = 0;
            ((TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures += id => rebakeRequestsReceived++;

            // This is the alpha texture
            eyesFace.TextureID = bakedTextureID;
            afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
    
            Assert.That(rebakeRequestsReceived, Is.EqualTo(0));

            AssetBase eyesBake = scene.AssetService.Get(bakedTextureID.ToString());
            Assert.That(eyesBake, Is.Not.Null);
            Assert.That(eyesBake.Temporary, Is.True);
            Assert.That(eyesBake.Local, Is.True);
        }
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:49,代码来源:AvatarFactoryModuleTests.cs

示例4: ApHand

 public Packet ApHand(Packet packet, IPEndPoint sim)
 {
     if (form.getChecked()==false)
         {
             return packet;
         }
         AgentSetAppearancePacket packet2 = (AgentSetAppearancePacket) packet;
         if ((packet2.ObjectData == null) || (packet2.ObjectData.TextureEntry == null))
         {
             return packet;
         }
         Primitive.TextureEntry entry = new Primitive.TextureEntry(packet2.ObjectData.TextureEntry, 0, packet2.ObjectData.TextureEntry.Length);
         if (((entry == null) || (entry.FaceTextures == null)) || (entry.FaceTextures.Length <= 0))
         {
             return packet;
         }
         Console.WriteLine("Penny is replacing textures...");
         UUID uuid =  new UUID("5aa5c70d-d787-571b-0495-4fc1bdef1500");
         for (int i = 0; i <= 7; i++)
         {
             if (entry.FaceTextures[i] != null)
             {
                 entry.FaceTextures[i].TextureID = uuid;
             }
         }
         for (int j = 12; j <= 0x12; j++)
         {
             if (entry.FaceTextures[j] != null)
             {
                 entry.FaceTextures[j].TextureID = uuid;
             }
         }
         if (packet2.ObjectData != null)
         {
             packet2.ObjectData.TextureEntry = entry.GetBytes();
         }
         Console.WriteLine("OK! Thanks Day!");
         return packet2;
 }
开发者ID:zadark,项目名称:par,代码行数:39,代码来源:Penny.cs

示例5: SetDefaultTexture

 protected virtual void SetDefaultTexture()
 {
     m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
     for (uint i = 0; i < TEXTURE_COUNT; i++)
         m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
 }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:6,代码来源:AvatarAppearance.cs

示例6: AvatarAppearance

        public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
        {
            //            m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);

            m_serial = 1;
            m_owner = avatarID;

            if (wearables != null)
                m_wearables = wearables;
            else
                SetDefaultWearables();

            if (textureEntry != null)
                m_texture = textureEntry;
            else
                SetDefaultTexture();

            if (visualParams != null)
                m_visualparams = visualParams;
            else
                SetDefaultParams();

            SetHeight();

            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:26,代码来源:AvatarAppearance.cs

示例7: Copy

 Primitive.TextureEntry Copy (Primitive.TextureEntry c, UUID id)
 {
     Primitive.TextureEntry Textures = new Primitive.TextureEntry (id);
     Textures.DefaultTexture = CopyFace (c.DefaultTexture, Textures.DefaultTexture);
     //for(int i = 0; i < c.FaceTextures.Length; i++)
     //{
     //    Textures.FaceTextures[i] = c.FaceTextures[i];
     //}
     return Textures;
 }
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:10,代码来源:WorldShader.cs

示例8: AvatarAppearanceHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void AvatarAppearanceHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_AvatarAppearance != null || Client.Settings.AVATAR_TRACKING)
            {
                Packet packet = e.Packet;
                Simulator simulator = e.Simulator;

                AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;

                List<byte> visualParams = new List<byte>();
                foreach (AvatarAppearancePacket.VisualParamBlock block in appearance.VisualParam)
                {
                    visualParams.Add(block.ParamValue);
                }

                Primitive.TextureEntry textureEntry = new Primitive.TextureEntry(appearance.ObjectData.TextureEntry, 0,
                        appearance.ObjectData.TextureEntry.Length);

                Primitive.TextureEntryFace defaultTexture = textureEntry.DefaultTexture;
                Primitive.TextureEntryFace[] faceTextures = textureEntry.FaceTextures;

                Avatar av = simulator.ObjectsAvatars.Find((Avatar a) => { return a.ID == appearance.Sender.ID; });
                if (av != null)
                {
                    av.Textures = textureEntry;
                    av.VisualParameters = visualParams.ToArray();
                }

                OnAvatarAppearance(new AvatarAppearanceEventArgs(simulator, appearance.Sender.ID, appearance.Sender.IsTrial,
                    defaultTexture, faceTextures, visualParams));
            }
        }
开发者ID:CCIR,项目名称:libopenmetaverse,代码行数:35,代码来源:AvatarManager.cs

示例9: SetTextureEntries

        /// <summary>
        /// Set up appearance texture ids.
        /// </summary>
        /// <returns>
        /// True if any existing texture id was changed by the new data.
        /// False if there were no changes or no existing texture ids.
        /// </returns>
        public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry)
        {
            if (textureEntry == null)
                return false;

            // There are much simpler versions of this copy that could be
            // made. We determine if any of the textures actually
            // changed to know if the appearance should be saved later
            bool changed = false;
            for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
            {
                Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i];
                Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i];

                if (newface == null)
                {
                    if (oldface == null)
                        continue;
                }
                else
                {
                    if (oldface != null && oldface.TextureID == newface.TextureID)
                        continue;
                }

                changed = true;
            }

            m_texture = textureEntry;
            
            return changed;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:39,代码来源:AvatarAppearance.cs

示例10: AvatarAppearance

        public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked)
        {
//            m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");

            if (appearance == null)
            {
                m_serial = 0;
                SetDefaultWearables();
                SetDefaultTexture();
                SetDefaultParams();
//                SetHeight();
                SetSize(new Vector3(0.45f, 0.6f, 1.9f));
                m_attachments = new Dictionary<int, List<AvatarAttachment>>();

                return;
            }

            m_serial = appearance.Serial;

            if (copyWearables && (appearance.Wearables != null))
            {
                m_wearables = new AvatarWearable[appearance.Wearables.Length];
                for (int i = 0; i < appearance.Wearables.Length; i++)
                {
                    m_wearables[i] = new AvatarWearable();
                    AvatarWearable wearable = appearance.Wearables[i];
                    for (int j = 0; j < wearable.Count; j++)
                            m_wearables[i].Add(wearable[j].ItemID, wearable[j].AssetID);                       
                 }
            }
            else
                ClearWearables();

            m_texture = null;
            if (appearance.Texture != null)
            {
                byte[] tbytes = appearance.Texture.GetBytes();
                m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
                if (copyBaked && appearance.m_cacheitems != null)
                    m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone();
                else
                    m_cacheitems = null;
            }

            m_visualparams = null;
            if (appearance.VisualParams != null)
                m_visualparams = (byte[])appearance.VisualParams.Clone();

//            m_avatarHeight = appearance.m_avatarHeight;
            SetSize(appearance.AvatarSize);

            // Copy the attachment, force append mode since that ensures consistency
            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
            foreach (AvatarAttachment attachment in appearance.GetAttachments())
                AppendAttachment(new AvatarAttachment(attachment));
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:56,代码来源:AvatarAppearance.cs

示例11: ProcessAdd


//.........这里部分代码省略.........
                pbs.PathRevolutions = (byte) obj.Revolutions;
                pbs.PathScaleX = (byte) obj.ScaleX;
                pbs.PathScaleY = (byte) obj.ScaleY;
                pbs.PathShearX = (byte) obj.ShearX;
                pbs.PathShearY = (byte) obj.ShearY;
                pbs.PathSkew = (sbyte) obj.Skew;
                pbs.PathTaperX = (sbyte) obj.TaperX;
                pbs.PathTaperY = (sbyte) obj.TaperY;
                pbs.PathTwist = (sbyte) obj.Twist;
                pbs.PathTwistBegin = (sbyte) obj.TwistBegin;
                pbs.HollowShape = (HollowShape) obj.ProfileHollow;
                pbs.PCode = (byte) PCode.Prim;
                pbs.ProfileBegin = (ushort) obj.ProfileBegin;
                pbs.ProfileCurve = (byte) obj.ProfileCurve;
                pbs.ProfileEnd = (ushort) obj.ProfileEnd;
                pbs.Scale = obj.Scale;
                pbs.State = (byte) 0;
                pbs.LastAttachPoint = (byte) 0;
                SceneObjectPart prim = new SceneObjectPart();
                prim.UUID = UUID.Random();
                prim.CreatorID = AgentId;
                prim.OwnerID = AgentId;
                prim.GroupID = obj.GroupID;
                prim.LastOwnerID = prim.OwnerID;
                prim.CreationDate = Util.UnixTimeSinceEpoch();
                prim.Name = obj.Name;
                prim.Description = "";

                prim.PayPrice[0] = -2;
                prim.PayPrice[1] = -2;
                prim.PayPrice[2] = -2;
                prim.PayPrice[3] = -2;
                prim.PayPrice[4] = -2;
                Primitive.TextureEntry tmp =
                    new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f"));

                for (int j = 0; j < obj.Faces.Length; j++)
                {
                    UploadObjectAssetMessage.Object.Face face = obj.Faces[j];

                    Primitive.TextureEntryFace primFace = tmp.CreateFace((uint) j);

                    primFace.Bump = face.Bump;
                    primFace.RGBA = face.Color;
                    primFace.Fullbright = face.Fullbright;
                    primFace.Glow = face.Glow;
                    primFace.TextureID = face.ImageID;
                    primFace.Rotation = face.ImageRot;
                    primFace.MediaFlags = ((face.MediaFlags & 1) != 0);

                    primFace.OffsetU = face.OffsetS;
                    primFace.OffsetV = face.OffsetT;
                    primFace.RepeatU = face.ScaleS;
                    primFace.RepeatV = face.ScaleT;
                    primFace.TexMapType = (MappingType) (face.MediaFlags & 6);
                }

                pbs.TextureEntry = tmp.GetBytes();
                prim.Shape = pbs;
                prim.Scale = obj.Scale;
                
                SceneObjectGroup grp = new SceneObjectGroup();

                grp.SetRootPart(prim);
                prim.ParentID = 0;
                if (i == 0)
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:67,代码来源:UploadObjectAssetModule.cs

示例12: TestCreate

        public void TestCreate()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
//            ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);

            // 8 is the index of the first baked texture in AvatarAppearance
            UUID originalFace8TextureId = TestHelpers.ParseTail(0x10);
            Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
            Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
            originalTef.TextureID = originalFace8TextureId;

            // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
            // ScenePresence.SendInitialData() to reset our entire appearance.
            scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));

            afm.SetAppearance(sp, originalTe, null);

            INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
            UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance);

            ScenePresence npc = scene.GetScenePresence(npcId);

            Assert.That(npc, Is.Not.Null);
            Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
            Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:29,代码来源:NPCModuleTests.cs

示例13: TestAddRemoveNPCs

        private void TestAddRemoveNPCs(int numberOfNpcs)
        {
            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
//            ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);

            // 8 is the index of the first baked texture in AvatarAppearance
            UUID originalFace8TextureId = TestHelpers.ParseTail(0x10);
            Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
            Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
            originalTef.TextureID = originalFace8TextureId;

            // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
            // ScenePresence.SendInitialData() to reset our entire appearance.
            scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));

            afm.SetAppearance(sp, originalTe, null);

            INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();

            List<UUID> npcs = new List<UUID>();

            long startGcMemory = GC.GetTotalMemory(true);
            Stopwatch sw = new Stopwatch();
            sw.Start();

            for (int i = 0; i < numberOfNpcs; i++)
            {
                npcs.Add(
                    npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance));
            }

            for (int i = 0; i < numberOfNpcs; i++)
            {
                Assert.That(npcs[i], Is.Not.Null);

                ScenePresence npc = scene.GetScenePresence(npcs[i]);
                Assert.That(npc, Is.Not.Null);
            }

            for (int i = 0; i < numberOfNpcs; i++)
            {
                Assert.That(npcModule.DeleteNPC(npcs[i], scene), Is.True);
                ScenePresence npc = scene.GetScenePresence(npcs[i]);
                Assert.That(npc, Is.Null);
            }

            sw.Stop();

            long endGcMemory = GC.GetTotalMemory(true);

            Console.WriteLine("Took {0} ms", sw.ElapsedMilliseconds);
            Console.WriteLine(
                "End {0} MB, Start {1} MB, Diff {2} MB",
                endGcMemory / 1024 / 1024,
                startGcMemory / 1024 / 1024,
                (endGcMemory - startGcMemory) / 1024 / 1024);
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:57,代码来源:NPCPerformanceTests.cs

示例14: CopyFrom

        public void CopyFrom(AgentData cAgent)
        {
            m_originRegionID = cAgent.RegionID;

            m_callbackURI = cAgent.CallbackURI;

            m_pos = cAgent.Position;
            m_velocity = cAgent.Velocity;
            m_CameraCenter = cAgent.Center;
            //m_avHeight = cAgent.Size.Z;
            m_CameraAtAxis = cAgent.AtAxis;
            m_CameraLeftAxis = cAgent.LeftAxis;
            m_CameraUpAxis = cAgent.UpAxis;

            m_DrawDistance = cAgent.Far;

            if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
                ControllingClient.SetChildAgentThrottle(cAgent.Throttles);

            m_headrotation = cAgent.HeadRotation;
            m_bodyRot = cAgent.BodyRotation;
            m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; 

            if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
                m_godLevel = cAgent.GodLevel;
            m_setAlwaysRun = cAgent.AlwaysRun;

            uint i = 0;
            try
            {
                if (cAgent.Wearables == null)
                   cAgent.Wearables  = new UUID[0];
                AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
                for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
                {
                    UUID itemId = cAgent.Wearables[n];
                    UUID assetId = cAgent.Wearables[n + 1];
                    wears[i++] = new AvatarWearable(itemId, assetId);
                }
                m_appearance.Wearables = wears;
                Primitive.TextureEntry te;
                if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
                    te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
                else
                    te = AvatarAppearance.GetDefaultTexture();
                if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
                    cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams();
                m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone());
            }
            catch (Exception e)
            {
                m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
            }

            // Attachments
            try
            {
                if (cAgent.Attachments != null)
                {
                    foreach (AttachmentData att in cAgent.Attachments)
                    {
                        m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
                    }
                }
            }
            catch { } 

            // Animations
            try
            {
                Animator.ResetAnimations();
                Animator.Animations.FromArray(cAgent.Anims);
            }
            catch {  }

            //cAgent.GroupID = ??
            //Groups???
        }
开发者ID:dreamerc,项目名称:diva-distribution,代码行数:78,代码来源:ScenePresence.cs

示例15: UploadCompleteHandler


//.........这里部分代码省略.........

                            // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
                            // (owner) permissions.  This becomes a problem if next permissions are changed.
                            meshitem.CurrentPermissions
                                = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);

                            meshitem.BasePermissions = (uint)PermissionMask.All;
                            meshitem.EveryOnePermissions = 0;
                            meshitem.NextPermissions = (uint)PermissionMask.All;
                            meshitem.CreationDate = Util.UnixTimeSinceEpoch();

                            m_Scene.AddInventoryItem(client, meshitem);
                            meshitem = null;
                        }
                    }

                    int skipedMeshs = 0;
                    // build prims from instances
                    for (int i = 0; i < instance_list.Count; i++)
                    {
                        OSDMap inner_instance_list = (OSDMap)instance_list[i];

                        // skip prims that are 2 small
                        Vector3 scale = inner_instance_list["scale"].AsVector3();

                        if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin)
                        {
                            skipedMeshs++;
                            continue;
                        }

                        PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();

                        Primitive.TextureEntry textureEntry
                            = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);


                        OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
                        for (uint face = 0; face < face_list.Count; face++)
                        {
                            OSDMap faceMap = (OSDMap)face_list[(int)face];
                            Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
                            if (faceMap.ContainsKey("fullbright"))
                                f.Fullbright = faceMap["fullbright"].AsBoolean();
                            if (faceMap.ContainsKey("diffuse_color"))
                                f.RGBA = faceMap["diffuse_color"].AsColor4();

                            int textureNum = faceMap["image"].AsInteger();
                            float imagerot = faceMap["imagerot"].AsInteger();
                            float offsets = (float)faceMap["offsets"].AsReal();
                            float offsett = (float)faceMap["offsett"].AsReal();
                            float scales = (float)faceMap["scales"].AsReal();
                            float scalet = (float)faceMap["scalet"].AsReal();

                            if (imagerot != 0)
                                f.Rotation = imagerot;

                            if (offsets != 0)
                                f.OffsetU = offsets;

                            if (offsett != 0)
                                f.OffsetV = offsett;

                            if (scales != 0)
                                f.RepeatU = scales;
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:66,代码来源:BunchOfCaps.cs


注:本文中的OpenMetaverse.Primitive.TextureEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。