protected override void OnCaptureFrame_() { if (studio.shadow.type == ShadowType.TopDown) { Camera camera; GameObject fieldObj; ShadowHelper.GetCameraAndFieldObject(studio.shadow.obj, out camera, out fieldObj); ShadowHelper.BakeStaticShadow(camera, fieldObj, particleModel, studio); } }
public void OnCaptureFrame() { try { double deltaTime = EditorApplication.timeSinceStartup - prevTime; if (deltaTime < studio.frame.delay) { return; } prevTime = EditorApplication.timeSinceStartup; if (studio.shadow.type == ShadowType.TopDown) { Camera camera; GameObject fieldObj; ShadowHelper.GetCameraAndFieldObject(studio.shadow.obj, out camera, out fieldObj); ShadowHelper.BakeStaticShadow(camera, fieldObj, particleModel, studio); } Texture2D tex = CapturingHelper.CaptureModelManagingShadow(model, studio); IntegerBound texBound = new IntegerBound(); if (!TextureHelper.CalcTextureBound(tex, pivot2D, texBound)) { texBound.min.x = pivot2D.x - 1; texBound.max.x = pivot2D.x + 1; texBound.min.y = pivot2D.y - 1; texBound.max.y = pivot2D.y + 1; } if (studio.trimming.on) { if (studio.trimming.isUnifiedForAllViews) { TextureHelper.MakeUnifiedBound(pivot2D, texBound, unifiedTexBound); } else { pivot2D.SubtractWithMargin(texBound.min, studio.trimming.margin); tex = TextureHelper.TrimTexture(tex, texBound, studio.trimming.margin, EngineGlobal.CLEAR_COLOR32); } } if (studio.packing.on || studio.trimming.isUnifiedForAllViews) { frameModelTextures[frameIndex] = tex; framePivots[frameIndex] = pivot2D; } else // !studio.packing.on && !studio.trim.isUnifiedSize { BakeIndividually(tex, pivot2D, viewName, frameIndex); } stateMachine.ChangeState(BakingState.EndFrame); } catch (Exception e) { Debug.LogException(e); Finish(); } }