This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var settings = new XmlWriterSettings() | |
| { | |
| NewLineOnAttributes = true | |
| }; | |
| using(XmlWriter writer = XmlWriter.Create(filestream, settings)) | |
| { | |
| // Write out document.. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MIN_INSIDE_FACES = 4; | |
| MIN_INSIDE_PERCENTAGE = 0.03f; | |
| int cubemap_sides_seeing_inside = 0; | |
| for (int i = 0; i < 6; i++) | |
| { | |
| RenderCubeMapSide(i); | |
| float backfacePercentage = CalculateBackfacePercentage(i); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() | |
| { | |
| gl_FragColor = gl_FrontFacing ? vec4(0,0,1,1) : vec4(1,0,0,1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %typemap(cscode) YourBaseRTTIObject | |
| %{ | |
| internal YourBaseRTTIObject m_castedSource; | |
| public bool IsKindOf<T>() | |
| { | |
| // Use your C++ RTTI system to test if this wrapped C# object's | |
| // native object is a 'typeof(T).Name' | |
| } | |
| %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static Dictionary<Type, Func<IntPtr, bool, object>> constructorCache = | |
| new Dictionary<Type, Func<IntPtr, bool, object>>(); | |
| private static Func<IntPtr, bool, object> CreateConstructorDelegate<T>() | |
| { | |
| // We need to first grab the reflection information for the more derrived type we're casting to. | |
| // SWIG has protected constructors we'll be able to call that take 2 parameters, the native pointer | |
| // to the type and whether or not SWIG owns the memory | |
| ConstructorInfo ctor = typeof(T).GetConstructor( | |
| BindingFlags.Instance | BindingFlags.NonPublic, null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static T CastTo<t>(YourBaseRTTIObject self) where T : YourBaseRTTIObject | |
| { | |
| if (self == null) | |
| return null; | |
| // Check if the object is actually the type we're trying to cast to. | |
| if (self.IsKindOf<t>()) | |
| { | |
| Type type = typeof(T); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if !defined(SWIG) | |
| #define MYNEW ... | |
| #define MYDELETE ... | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %typemap(out) const Vector3& %{ $result = new Vector3(*$1); %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Matrix | |
| { | |
| Matrix(); | |
| Matrix& Identity(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Matrix4 wrappedMatrix = new Matrix4(); | |
| return wrappedMatrix.Identity(); |
OlderNewer