示例#1
0
 public void Draw(SpriteBatch sb, Camera camera, Material.TextureType texType = Material.TextureType.Diffuse)
 {
     if (Material != null)
     {
         base.Draw(sb, texType);
     }
     else if (texType == Material.TextureType.Diffuse)
     {
         DrawOutline(sb, Color.Red, camera);
     }
 }
示例#2
0
 public void Draw(SpriteBatch sb, Camera camera, Material.TextureType texType = Material.TextureType.Diffuse)
 {
     base.Draw(sb, texType);
 }
        /// <summary>
        /// Constructor which builds a material property object from a pointer to an aiMaterialProperty structure.  As a user, you should not call this by hand.
        /// <remarks>This will copy the data inside the structure into managed memory.  It *DOES NOT* free the unmanaged memory.</remarks>
        /// </summary>
        /// <param name="aiMaterialProperty*">A pointer to the face structure in the low level unmanaged wrapper.</param>
        internal unsafe MaterialProperty(IntPtr p_aiMaterialProperty)
        {
            // Unmarshal our structure into (what will be for us, some temporary) managed memory.  This is naturally, automatically released when we exit the function.
            UnmanagedAssimp.aiMaterialProperty tProperty = (UnmanagedAssimp.aiMaterialProperty)Marshal.PtrToStructure(p_aiMaterialProperty, typeof(UnmanagedAssimp.aiMaterialProperty));

            // Copy the nice simple value types into managed memory.
            this.sKey       = "" + tProperty.mKey.data;
            this.eSemantic  = (Material.TextureType)tProperty.mSemantic;
            this.iIndex     = tProperty.mIndex;
            this.eType      = (Material.PropertyTypeInfo)tProperty.mType;

            // Setup the pointer and pointer stride to read the bugger.
            int iStride = sizeof(byte);
            IntPtr pPtr = new IntPtr(tProperty.mData);

            // Copy the raw bytes from assimp into the managed array.
            byte[] tData = new byte[tProperty.mDataLength];
            for (int iByte = 0; iByte < tProperty.mDataLength; ++iByte)
            {
                tData[iByte] = Marshal.ReadByte(pPtr);
                pPtr = new IntPtr(pPtr.ToInt64() + iStride);
            }

            kData = (object)tData;
        }