Beispiel #1
0
 private void InitObjectBuffer(ref ObjectBuffer pBuffer, int index)
 {
     pBuffer          = new ObjectBuffer();
     pBuffer.pos      = mMRL[index].transform.position;
     pBuffer.size     = Vector3.Magnitude(mMRL[index].bounds.extents);
     pBuffer.hideMode = 0;
 }
Beispiel #2
0
    private void CullOCB()
    {
        int count = mMRL.Count;

        ObjectBuffer[] oba = new ObjectBuffer[count];
        mObjectCBuffer.GetData(oba);
        int endNum = mOCpt + ObjectQuantityPerFrame > count ? count : mOCpt + ObjectQuantityPerFrame;

        for (int i = mOCpt; i < endNum; i++)
        {
            if (mMRL[i] != null)
            {
                if (oba[i].hideMode == 0)
                {
                    if (!mMRL[i].enabled)
                    {
                        mMRL[i].enabled = true;
                    }
                }
                else if (oba[i].hideMode == 1)
                {
                    if (mMRL[i].enabled)
                    {
                        mMRL[i].enabled = false;
                    }
                }
            }
        }
        mOCpt = mOCpt + ObjectQuantityPerFrame > count ? 0 : mOCpt + ObjectQuantityPerFrame;
    }
Beispiel #3
0
        public HullDataManager(HullGeometryInfo geometryInfo)
        {
            NumDecks = geometryInfo.NumDecks;
            CurDeck = 0;
            VisibleDecks = NumDecks;
            HullBuffers = geometryInfo.HullWallTexBuffers;
            DeckBuffers = geometryInfo.DeckFloorBuffers;
            DeckFloorBoundingBoxes = geometryInfo.DeckFloorBoundingBoxes;
            FloorVertexes = geometryInfo.FloorVertexes;
            DeckHeight = geometryInfo.DeckHeight;
            WallResolution = geometryInfo.WallResolution;
            CenterPoint = geometryInfo.CenterPoint;

            WallBuffers = new ObjectBuffer<ObjectIdentifier>[NumDecks];
            for (int i = 0; i < WallBuffers.Count(); i++){
                int potentialWalls = geometryInfo.FloorVertexes[i].Count()*2;
                WallBuffers[i] = new ObjectBuffer<ObjectIdentifier>(potentialWalls, 10, 20, 30, "HullWallTex");
            }

            WallIdentifiers = new List<ObjectIdentifier>[NumDecks];
            for (int i = 0; i < WallIdentifiers.Length; i++){
                WallIdentifiers[i] = new List<ObjectIdentifier>();
            }

            //override default lighting
            foreach (var buffer in DeckBuffers){
                buffer.DiffuseDirection = new Vector3(0, 1, 0);
            }
            foreach (var buffer in HullBuffers){
                buffer.DiffuseDirection = new Vector3(0, -1, 1);
                buffer.CullMode = CullMode.None;
            }
        }
 public void workProcessed(ObjectBuffer <Bookmark> item)
 {
     foreach (Bookmark bookmark in item.Items)
     {
         controller.fireBookmarkAdded(bookmark);
     }
     item.reset();
 }
Beispiel #5
0
 public void workProcessed(ObjectBuffer <PatientDataFile> item)
 {
     foreach (PatientDataFile file in item.Items)
     {
         dialog.addFile(file);
     }
     item.reset();
 }
Beispiel #6
0
        //--------------------------------------------------------------------------------------------------------------------
        // - Spawn Actor Onto Map
        //--------------------------------------------------------------------------------------------------------------------
        public bool Join(Actor actor, int x, int y)
        {
            // Cannot join an occupied space
            if (!Occupied(x, y))
            {
                ObjectBuffer.Add(actor);
                actor.Environment = this;
                actor.Position    = new Vector3f(x, y, Height(x, y));
            }

            return(false);
        }
Beispiel #7
0
        public WallBuildTool(HullDataManager hullData)
            : base(hullData)
        {
            _tempWallBuffer = new ObjectBuffer<ObjectIdentifier>(
                hullData.FloorVertexes[0].Count()*2,
                10,
                20,
                30,
                "InternalWallTex")
                              {UpdateBufferManually = true};

            _tempWallIdentifiers = new List<ObjectIdentifier>();
        }
Beispiel #8
0
 public PanelAsset(int id, string name, string resPath, EPanelMode mode, EPanelProperty property)
 {
     Id                = id;
     Name              = name;
     AssetPath         = resPath;
     Mode              = mode;
     Properties        = property;
     IsUsable          = !string.IsNullOrEmpty(AssetPath);
     mIsBuiltIn        = false;
     mBuffer           = new ObjectBuffer <Panel>(IsSingleInstance ? 1 : 5);
     mBuffer.Creater   = LoadFromResources;
     mBuffer.Destroier = UnloadResources;
 }
Beispiel #9
0
 private void CreateObjectBuffer(int count)
 {
     if (mObjectCBuffer != null)
     {
         mObjectCBuffer.Release();
     }
     mObjectCBuffer = new ComputeBuffer(count, sizeof(float) * 3 + sizeof(float) + sizeof(int));
     ObjectBuffer[] buffers = new ObjectBuffer[count];
     for (int i = 0; i < count; i++)
     {
         InitObjectBuffer(ref buffers[i], i);
     }
     mObjectCBuffer.SetData(buffers);
 }
Beispiel #10
0
 public PanelAsset(JObject data)
 {
     if (data != null)
     {
         Id                = data.Value <int>("id");
         Name              = data.Value <string>("name");
         AssetPath         = data.Value <string>("assetPath");
         Mode              = (EPanelMode)data.Value <int>("mode");
         Properties        = (EPanelProperty)data.Value <int>("property");
         IsUsable          = !string.IsNullOrEmpty(AssetPath);
         mIsBuiltIn        = false;
         mBuffer           = new ObjectBuffer <Panel>(IsSingleInstance ? 1 : 5);
         mBuffer.Creater   = LoadFromResources;
         mBuffer.Destroier = UnloadResources;
     }
     else
     {
         IsUsable = false;
     }
 }
Beispiel #11
0
        Drawing3d.PrimIdObj[,] SubArray(int x, int y, int Width, int Height)
        {
            Drawing3d.PrimIdObj[,] Result = new Drawing3d.PrimIdObj[Width, Height];
            if (ObjectBuffer == null)
            {
                return(Result);
            }
            for (int i = 0; i < Width; i++)
            {
                for (int j = 0; j < Height; j++)
                {
                    if ((i + x >= 0) && (j + y >= 0) && (i + x < ObjectBuffer.GetLength(0)) && (j + y < ObjectBuffer.GetLength(1)))
                    {
                        Result[i, j] = ObjectBuffer[i + x, j + y];
                    }
                }
            }

            return(Result);
        }
Beispiel #12
0
 public PanelAsset(Panel asset)
 {
     if (asset != null)
     {
         Name          = asset.name;
         Id            = string.IsNullOrEmpty(Name) ? 0 : StringUtil.ToHash(Name);
         AssetPath     = null;
         mBuiltinAsset = asset;
         Mode          = asset.m_Mode;
         Properties    = asset.m_Properties;
         asset.gameObject.SetActive(false);
         IsUsable          = true;
         mIsBuiltIn        = true;
         mBuffer           = new ObjectBuffer <Panel>(IsSingleInstance ? 1 : 5);
         mBuffer.Creater   = LoadFromBuiltin;
         mBuffer.Destroier = UnloadResources;
         mBuffer.SaveBuffer(mBuiltinAsset);
     }
     else
     {
         IsUsable = false;
     }
 }
Beispiel #13
0
        //--------------------------------------------------------------------------------------------------------------------
        // - Place Tile At [X,Y]
        //--------------------------------------------------------------------------------------------------------------------
        // Places a tile on top of the top-most tile already located ay (X, Y), if one is present
        //--------------------------------------------------------------------------------------------------------------------
        public bool Place(Tile tile, int x, int y)
        {
            // Confirm the requested position is within the bounds of the map
            if (x >= 0 && x < Width && y >= 0 && y < Length)
            {
                float z = 0;

                // Find the top-most tile at [X, Y] ...
                if (Tiles[x, y].Any())
                {
                    Tile top = Tiles[x, y].Last();

                    // Set the incoming tile's Z-coodinate to the Z + Height of the top-most tile
                    z = top.Position.Z + top.Height();

                    // Acquire the top-most tile's occupant, if present, which should be an non-tile; then, set the top-most
                    // tile's occupant to this new tile
                    tile.Occupant = top.Occupant;
                    top.Occupant  = tile;

                    // If this tile did gain an occupant, raise it's Z-coordinate appropriately
                    if (tile.Occupant != null)
                    {
                        tile.Occupant.Position = new Vector3f(tile.Occupant.Position.X, tile.Occupant.Position.Y, tile.Occupant.Position.Z + tile.Height());
                    }
                }

                tile.Position = new Vector3f(x, y, z);
                Tiles[x, y].Add(tile);
                ObjectBuffer.Add(tile);

                // Report a successful placement
                return(true);
            }
            return(false);
        }
Beispiel #14
0
 internal override string ToScriptObject()
 {
     return(ObjectBuffer.ObjPrefix + ObjectBuffer.GetObjectId(this).ToString());
 }
Beispiel #15
0
 internal override string ToScriptObject()
 {
     return(ObjectBuffer.OBJ_PREFIX + ObjectBuffer.GetObjectId(this).ToString());
 }
Beispiel #16
0
 //--------------------------------------------------------------------------------------------------------------------
 // - Draw Tilemap (Implementation)
 //--------------------------------------------------------------------------------------------------------------------
 public void Draw(RenderTarget target, RenderStates states)
 {
     ObjectBuffer.Draw(target, states);
 }
Beispiel #17
0
 //--------------------------------------------------------------------------------------------------------------------
 // - Remove Actor From Map
 //--------------------------------------------------------------------------------------------------------------------
 public void Leave(Actor actor)
 {
     ObjectBuffer.Remove(actor);
     actor.Environment = null;
 }
Beispiel #18
0
 public WallDeleteTool(HullDataManager hullData)
     : base(hullData)
 {
     _tempWallBuffer = new ObjectBuffer<ObjectIdentifier>(5000, 10, 20, 30, "WallDeleteMarqueeTex"){UpdateBufferManually = true};
     _prevIdentifiers = new List<ObjectIdentifier>();
 }