Represents a CryENGINE material applicable to any ingame object or entity.
Exemplo n.º 1
0
        public void SwitchToCharacterObject(string chrModel, Material material)
        {
            IntPtr materialPtr = IntPtr.Zero;
            if (material != null)
                materialPtr = material.Handle;

            NativeEntityMethods.BindAttachmentToCHR(Handle, chrModel, materialPtr);
        }
Exemplo n.º 2
0
        public void SwitchToStaticObject(string cgfModel, Material material = null)
        {
            IntPtr materialPtr = IntPtr.Zero;
            if(material != null)
                materialPtr = material.Handle;

            NativeEntityMethods.BindAttachmentToCGF(Handle, cgfModel, materialPtr);
        }
Exemplo n.º 3
0
        private static Material TryAdd(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                return null;

            var mat = materials.FirstOrDefault(x => x.Handle == ptr);
            if (mat != default(Material))
                return mat;

            mat = new Material(ptr);
            materials.Add(mat);

            return mat;
        }
Exemplo n.º 4
0
        public static void Set(EntityBase entity, Material mat, int slot = 0)
        {
            #if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (entity == null)
                throw new ArgumentNullException("entity");
            if (mat == null)
                throw new ArgumentNullException("mat");
            #endif

            NativeMaterialMethods.SetMaterial(entity.GetEntityHandle(), mat.Handle, slot);
        }
Exemplo n.º 5
0
        internal static Material TryGet(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                return null;

            var mat = Materials.FirstOrDefault(x => x.Handle == ptr);
            if (mat != null)
                return mat;

            mat = new Material(ptr);
            Materials.Add(mat);

            return mat;
        }
Exemplo n.º 6
0
        public static void Set(EntityWrapper entity, Material mat, int slot = 0)
        {
            #if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (entity == null)
                throw new ArgumentNullException("entity");
            if (mat == null)
                throw new ArgumentNullException("mat");
            #endif

            MaterialInterop.SetMaterial(entity.EntityHandle, mat.Handle, slot);
        }