Beispiel #1
0
        public uint Add(Decal decal)
        {
            if (decal == null)
            {
                throw new ArgumentNullException("decal");
            }
            var pointer       = UnsafeNativeMethods.Rdk_DecalCreateParams_New();
            var origin        = decal.Origin;
            var up_vector     = decal.VectorUp;
            var across_vector = decal.VectorAcross;

            UnsafeNativeMethods.Rdk_DecalCreateParams_SetFrame(pointer, ref origin, ref up_vector, ref across_vector);
            UnsafeNativeMethods.Rdk_DecalCreateParams_SetMap(pointer, decal.TextureInstanceId, (int)decal.DecalMapping, (int)decal.DecalProjection, decal.MapToInside, decal.Transparency);
            UnsafeNativeMethods.Rdk_DecalCreateParams_SetCylindricalAndSpherical(pointer, decal.Height, decal.Radius, decal.StartLatitude, decal.EndLatitude, decal.StartLongitude, decal.EndLongitude);
            double minu = 0.0, maxu = 0.0, minv = 0.0, maxv = 0.0;

            decal.UVBounds(ref minu, ref minv, ref maxu, ref maxv);
            UnsafeNativeMethods.Rdk_DecalCreateParams_SetUV(pointer, minu, minv, maxu, maxv);
            var non_const_pointer = m_parent_attributes.NonConstPointer();
            var success           = UnsafeNativeMethods.Rdk_Decals_AddDecal(pointer, non_const_pointer);

            UnsafeNativeMethods.Rdk_DecalCreateParams_Delete(pointer);
            // TODO
            // Eventually this class will be derived from IList<Decal> which requires
            // a "int Add(T)" method so return the index of the new decal instead of
            // the Id.
            return(success);
        }
Beispiel #2
0
        internal DecalEnumerator(ObjectAttributes attributes)
        {
            var pointer = attributes.NonConstPointer();

            m_decal_iterator = UnsafeNativeMethods.Rdk_Decals_NewDecalIteratorForObjectAttributes(pointer);
        }