Exemplo n.º 1
0
        /// <summary>
        /// Reads the unmanaged data from the native value.
        /// </summary>
        /// <param name="nativeValue">Input native value</param>
        void IMarshalable <Node, AiNode> .FromNative(ref AiNode nativeValue)
        {
            m_name      = nativeValue.Name.GetString();
            m_transform = nativeValue.Transformation;
            m_parent    = null;
            m_children.Clear();
            m_meshes.Clear();
            m_metaData.Clear();

            if (nativeValue.MetaData != IntPtr.Zero)
            {
                Metadata data = MemoryHelper.FromNativePointer <Metadata, AiMetadata>(nativeValue.MetaData);
                foreach (KeyValuePair <String, Metadata.Entry> kv in data)
                {
                    m_metaData.Add(kv.Key, kv.Value);
                }
            }

            if (nativeValue.NumMeshes > 0 && nativeValue.Meshes != IntPtr.Zero)
            {
                m_meshes.AddRange(MemoryHelper.FromNativeArray <int>(nativeValue.Meshes, (int)nativeValue.NumMeshes));
            }

            if (nativeValue.NumChildren > 0 && nativeValue.Children != IntPtr.Zero)
            {
                m_children.AddRange(MemoryHelper.FromNativeArray <Node, AiNode>(nativeValue.Children, (int)nativeValue.NumChildren, true));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Clears the scene of all components.
 /// </summary>
 public void Clear()
 {
     m_rootNode = null;
     m_meshes.Clear();
     m_lights.Clear();
     m_cameras.Clear();
     m_textures.Clear();
     m_animations.Clear();
     m_materials.Clear();
     m_metadata.Clear();
 }