Esempio n. 1
0
        public override void initialize()
        {
            List <EntityBase> objs = m_scene.GetEntities();

            lock (objs)
            {
                try
                {
                    foreach (EntityBase obj in objs)
                    {
                        if (obj is SceneObjectGroup)
                        {
                            SceneObjectGroup mapdot = (SceneObjectGroup)obj;
                            foreach (SceneObjectPart part in mapdot.Children.Values)
                            {
                                if (part == null)
                                {
                                    continue;
                                }
                                LLVector3CL        position   = Utility.toLLVector3(part.GroupPosition);
                                LLQuaternionCL     rotation   = Utility.toLLQuaternion(part.RotationOffset);
                                LLVector3CL        scale      = Utility.toLLVector3(part.Scale);
                                PrimitiveBaseShape shape      = part.Shape;
                                LLPathParamsCL     pathParams = new LLPathParamsCL(shape.PathCurve,
                                                                                   shape.PathBegin, shape.PathEnd,
                                                                                   shape.PathScaleX, shape.PathScaleY,
                                                                                   shape.PathShearX, shape.PathShearY,
                                                                                   shape.PathTwist, shape.PathTwistBegin,
                                                                                   shape.PathRadiusOffset,
                                                                                   shape.PathTaperX, shape.PathTaperY,
                                                                                   shape.PathRevolutions, shape.PathSkew);
                                LLProfileParamsCL profileParams = new LLProfileParamsCL(shape.ProfileCurve,
                                                                                        shape.ProfileBegin, shape.ProfileEnd, shape.ProfileHollow);
                                LLVolumeParamsCL volumeParams = new LLVolumeParamsCL(profileParams, pathParams);

                                int facenum = part.GetNumberOfSides();
                                List <SimpleColorCL> colors = new List <SimpleColorCL>();
                                for (uint j = 0; j < facenum; j++)
                                {
                                    TextureColorModel data = Utility.GetDataFromFile(shape.Textures.GetFace(j).TextureID.ToString());
                                    colors.Add(new SimpleColorCL(data.A, data.R, data.G, data.B));
                                }

                                m_primitiveList.Add(new PrimitiveCL(volumeParams, position, rotation, scale, colors.ToArray(), facenum));
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[WebMapService]: Initialize object layer failed with {0} {1}", e.Message, e.StackTrace);
                }
            }
        }
Esempio n. 2
0
        public override void initialize()
        {
            List<EntityBase> objs = m_scene.GetEntities();

            lock (objs)
            {
                try
                {
                    foreach (EntityBase obj in objs)
                    {
                        if (obj is SceneObjectGroup)
                        {
                            SceneObjectGroup mapdot = (SceneObjectGroup)obj;
                            foreach (SceneObjectPart part in mapdot.Children.Values)
                            {
                                if (part == null)
                                    continue;
                                LLVector3CL position = Utility.toLLVector3(part.GroupPosition);
                                LLQuaternionCL rotation = Utility.toLLQuaternion(part.RotationOffset);
                                LLVector3CL scale = Utility.toLLVector3(part.Scale);
                                PrimitiveBaseShape shape = part.Shape;
                                LLPathParamsCL pathParams = new LLPathParamsCL(shape.PathCurve,
                                    shape.PathBegin, shape.PathEnd,
                                    shape.PathScaleX, shape.PathScaleY,
                                    shape.PathShearX, shape.PathShearY,
                                    shape.PathTwist, shape.PathTwistBegin,
                                    shape.PathRadiusOffset,
                                    shape.PathTaperX, shape.PathTaperY,
                                    shape.PathRevolutions, shape.PathSkew);
                                LLProfileParamsCL profileParams = new LLProfileParamsCL(shape.ProfileCurve,
                                    shape.ProfileBegin, shape.ProfileEnd, shape.ProfileHollow);
                                LLVolumeParamsCL volumeParams = new LLVolumeParamsCL(profileParams, pathParams);

                                int facenum = part.GetNumberOfSides();
                                List<SimpleColorCL> colors = new List<SimpleColorCL>();
                                for (uint j = 0; j < facenum; j++)
                                {
                                    TextureColorModel data = Utility.GetDataFromFile(shape.Textures.GetFace(j).TextureID.ToString());
                                    colors.Add(new SimpleColorCL(data.A, data.R, data.G, data.B));
                                }

                                m_primitiveList.Add(new PrimitiveCL(volumeParams, position, rotation, scale, colors.ToArray(), facenum));
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[WebMapService]: Initialize object layer failed with {0} {1}", e.Message, e.StackTrace);
                }
            }
        }