回答編集履歴
1
ビルド後の場合に発生する不具合に対処するための修正を追加
answer
CHANGED
@@ -141,6 +141,15 @@
|
|
141
141
|
RenderTexture activeTexture = RenderTexture.active;
|
142
142
|
RenderTexture.active = renderTexture;
|
143
143
|
GL.PushMatrix();
|
144
|
+
|
145
|
+
// プレイモードだとCamera.currentはnullだが、ビルド後の場合はnullではなくDrawMeshNowの時に
|
146
|
+
// 余計な影響を及ぼしてくるようだったため、Camera.currentのビュー行列を無効化して干渉を防ぐ
|
147
|
+
var currentCamera = Camera.current;
|
148
|
+
if (currentCamera != null)
|
149
|
+
{
|
150
|
+
currentCamera.worldToCameraMatrix = Matrix4x4.identity;
|
151
|
+
}
|
152
|
+
|
144
153
|
GL.LoadProjectionMatrix(pixelMatrix * this.mainCamera.projectionMatrix);
|
145
154
|
|
146
155
|
// まずインデックスの初期値はオブジェクト・頂点ともに-1とでもしておき...
|
@@ -155,6 +164,11 @@
|
|
155
164
|
Graphics.DrawMeshNow(this.meshes[i], viewMatrix * this.renderers[i].localToWorldMatrix);
|
156
165
|
}
|
157
166
|
|
167
|
+
if (currentCamera != null)
|
168
|
+
{
|
169
|
+
currentCamera.ResetWorldToCameraMatrix();
|
170
|
+
}
|
171
|
+
|
158
172
|
GL.PopMatrix();
|
159
173
|
|
160
174
|
// renderTextureの内容をpixelTextureに読み取り、さらにpixelTextureから色を取り出す
|