Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RenderTargetCube.cs
Go to the documentation of this file.
1using System;
5
7
9{
11
12 internal bool _contentLost;
13
14 private EventHandler<EventArgs> _003Cbacking_store_003EContentLost;
15
16 public bool IsContentLost
17 {
18 [return: MarshalAs(UnmanagedType.U1)]
19 get
20 {
21 if (!_contentLost)
22 {
24 }
25 return _contentLost;
26 }
27 }
28
30
32
34
35 [SpecialName]
36 public virtual event EventHandler<EventArgs> ContentLost
37 {
38 [MethodImpl(MethodImplOptions.Synchronized)]
39 add
40 {
42 }
43 [MethodImpl(MethodImplOptions.Synchronized)]
44 remove
45 {
47 }
48 }
49
50 public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
51 {
52 try
53 {
54 CreateRenderTarget(graphicsDevice, size, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
55 return;
56 }
57 catch
58 {
59 //try-fault
60 base.Dispose(true);
61 throw;
62 }
63 }
64
65 public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
66 {
67 try
68 {
69 CreateRenderTarget(graphicsDevice, size, mipMap, preferredFormat, preferredDepthFormat, 0, RenderTargetUsage.DiscardContents);
70 return;
71 }
72 catch
73 {
74 //try-fault
75 base.Dispose(true);
76 throw;
77 }
78 }
79
80 private void _007ERenderTargetCube()
81 {
82 }
83
84 internal void CreateRenderTarget(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
85 {
86 if (graphicsDevice == null)
87 {
89 }
90 graphicsDevice.Adapter.QueryFormat(isBackBuffer: false, graphicsDevice._deviceType, graphicsDevice._graphicsProfile, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, out var selectedFormat, out var selectedDepthFormat, out var selectedMultiSampleCount);
91 TextureCube.ValidateCreationParameters(graphicsDevice._profileCapabilities, size, selectedFormat);
92 (helper = new RenderTargetHelper(this, size, size, selectedFormat, selectedDepthFormat, selectedMultiSampleCount, usage, graphicsDevice._profileCapabilities)).CreateSurfaces(graphicsDevice);
93 CreateTexture(graphicsDevice, size, mipMap, 1u, (_D3DPOOL)0, selectedFormat);
94 }
95
96 internal override int SaveDataForRecreation()
97 {
98 return 0;
99 }
100
102 {
103 //ILSpy generated this explicit interface implementation from .override directive in SaveDataForRecreation
104 return this.SaveDataForRecreation();
105 }
106
107 internal unsafe override int RecreateAndPopulateObject()
108 {
109 if (pComPtr != null)
110 {
111 return -2147467259;
112 }
113 int num = ((_levelCount > 1) ? 1 : 0);
114 CreateTexture(_parent, _size, (byte)num != 0, 1u, (_D3DPOOL)0, _format);
116 return 0;
117 }
118
120 {
121 //ILSpy generated this explicit interface implementation from .override directive in RecreateAndPopulateObject
122 return this.RecreateAndPopulateObject();
123 }
124
125 internal override void ReleaseNativeObject([MarshalAs(UnmanagedType.U1)] bool disposeManagedResource)
126 {
127 base.ReleaseNativeObject(disposeManagedResource);
129 }
130
131 void IGraphicsResource.ReleaseNativeObject([MarshalAs(UnmanagedType.U1)] bool disposeManagedResource)
132 {
133 //ILSpy generated this explicit interface implementation from .override directive in ReleaseNativeObject
134 this.ReleaseNativeObject(disposeManagedResource);
135 }
136
137 internal virtual void SetContentLost([MarshalAs(UnmanagedType.U1)] bool isContentLost)
138 {
139 _contentLost = isContentLost;
140 if (isContentLost)
141 {
143 }
144 }
145
146 void IDynamicGraphicsResource.SetContentLost([MarshalAs(UnmanagedType.U1)] bool isContentLost)
147 {
148 //ILSpy generated this explicit interface implementation from .override directive in SetContentLost
149 this.SetContentLost(isContentLost);
150 }
151
152 [SpecialName]
153 protected virtual void raise_ContentLost(object value0, EventArgs value1)
154 {
155 _003Cbacking_store_003EContentLost?.Invoke(value0, value1);
156 }
157
158 [HandleProcessCorruptedStateExceptions]
159 protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool P_0)
160 {
161 if (P_0)
162 {
163 try
164 {
165 return;
166 }
167 finally
168 {
169 base.Dispose(true);
170 }
171 }
172 base.Dispose(false);
173 }
174}
bool QueryFormat([MarshalAs(UnmanagedType.U1)] bool isBackBuffer, _D3DDEVTYPE deviceType, GraphicsProfile graphicsProfile, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, out SurfaceFormat selectedFormat, out DepthFormat selectedDepthFormat, out int selectedMultiSampleCount)
virtual void SetContentLost([MarshalAs(UnmanagedType.U1)] bool isContentLost)
override void ReleaseNativeObject([MarshalAs(UnmanagedType.U1)] bool disposeManagedResource)
override void Dispose([MarshalAs(UnmanagedType.U1)] bool P_0)
RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
virtual EventHandler< EventArgs > ContentLost
void CreateRenderTarget(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
virtual void raise_ContentLost(object value0, EventArgs value1)
EventHandler< EventArgs > _003Cbacking_store_003EContentLost
RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
unsafe void CreateSurfaces(GraphicsDevice graphicsDevice)
unsafe void CreateTexture(GraphicsDevice graphicsDevice, int size, [MarshalAs(UnmanagedType.U1)] bool mipMap, uint usage, _D3DPOOL pool, SurfaceFormat format)
static void ValidateCreationParameters(ProfileCapabilities profile, int size, SurfaceFormat format)
unsafe IDirect3DCubeTexture9 * pComPtr
static ? Delegate Remove(Delegate? source, Delegate? value)
Definition Delegate.cs:463
static ? Delegate Combine(Delegate? a, Delegate? b)
Definition Delegate.cs:379
static readonly EventArgs Empty
Definition EventArgs.cs:9
void SetContentLost([MarshalAs(UnmanagedType.U1)] bool isContentLost)
void ReleaseNativeObject([MarshalAs(UnmanagedType.U1)] bool disposeManagedResource)