Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateBinding()

DeclarationBinding Microsoft.Xna.Framework.Graphics.DeclarationManager.CreateBinding ( VertexDeclaration declaration)
inlinepackage

Definition at line 53 of file DeclarationManager.cs.

54 {
55 DeclarationBinding value = null;
56 bool lockTaken = false;
57 try
58 {
60 VertexElement[] elements = declaration._elements;
61 if (bindings.TryGetValue(elements, out value))
62 {
63 value.referenceCount++;
64 return value;
65 }
66 value = new DeclarationBinding(elements);
67 bindings.Add(elements, value);
68 return value;
69 }
70 finally
71 {
72 if (lockTaken)
73 {
74 Monitor.Exit(this);
75 }
76 }
77 }
Dictionary< VertexElement[], DeclarationBinding > bindings
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static void Exit(object obj)
static void Enter(object obj)

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), Microsoft.Xna.Framework.Graphics.DeclarationManager.bindings, System.Threading.Monitor.Enter(), System.Threading.Monitor.Exit(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.

Referenced by Microsoft.Xna.Framework.Graphics.VertexDeclaration.Bind().