Exemplo n.º 1
0
        public GfxObjInstance(uint gfxObjID)
        {
            GfxObj = GfxObjCache.Get(gfxObjID);

            Position = Vector3.Zero;
            Rotation = Quaternion.Identity;
            Scale    = Vector3.One;
        }
Exemplo n.º 2
0
 public static GfxObj Get(uint gfxObjID)
 {
     if (!Cache.TryGetValue(gfxObjID, out var gfxObj))
     {
         //Console.WriteLine($"- Loading {gfxObjID:X8}");
         gfxObj = new GfxObj(gfxObjID);
         Cache.Add(gfxObjID, gfxObj);
     }
     return(gfxObj);
 }
Exemplo n.º 3
0
        public Polygon(GfxObj gfxObj, ACE.DatLoader.Entity.Polygon polygon)
        {
            GfxObj   = gfxObj;
            _polygon = polygon;

            UVLookup = GfxObj.UVLookup;

            BuildIndices();
            //BuildIndexBuffer();

            Texture = gfxObj.Textures[polygon.PosSurface];
        }
Exemplo n.º 4
0
        public Setup(uint setupID, FileTypes.ObjDesc objDesc, Dictionary <int, uint> customPaletteColors)
        {
            // make simple setup if gfxobj. These don't have
            if (setupID >> 24 == 0x1)
            {
                MakeSimpleSetup(setupID);
                BuildBoundingBox();
                return;
            }

            _setup = DatManager.PortalDat.ReadFromDat <SetupModel>(setupID);

            Parts = new List <GfxObj>();
            for (var i = 0; i < _setup.Parts.Count; i++)
            {
                uint   gfxObjID;
                GfxObj gfxObj;

                var apChange = objDesc.AnimPartChanges.Where(s => s.PartIndex == i).FirstOrDefault();
                if (apChange != null)
                {
                    gfxObjID = apChange.PartID;
                    gfxObj   = new GfxObj(gfxObjID, false);
                    List <ACE.DatLoader.Entity.TextureMapChange> tmChanges = objDesc.TextureChanges.FindAll(s => s.PartIndex == i);


                    gfxObj.LoadTextures(tmChanges, customPaletteColors);
                    gfxObj.BuildPolygons();
                }
                else
                {
                    gfxObjID = _setup.Parts[i];
                    gfxObj   = new GfxObj(gfxObjID, false);
                    gfxObj.LoadTextures(null, null);
                    gfxObj.BuildPolygons();
                }

                Parts.Add(gfxObj);
            }

            PlacementFrames = new List <Matrix>();

            foreach (var placementFrame in _setup.PlacementFrames[0].AnimFrame.Frames)
            {
                PlacementFrames.Add(placementFrame.ToXna());
            }

            BuildBoundingBox();
        }