public WaveSpectrumBufferCPU(int size, int numBuffers, Scheduler scheduler) { this.m_buffers = new WaveSpectrumBufferCPU.Buffer[numBuffers]; this.m_fourier = new FourierCPU(size); this.m_fourierTasks = new List<FourierTask>(3); this.m_fourierTasks.Add(null); this.m_fourierTasks.Add(null); this.m_fourierTasks.Add(null); this.m_scheduler = scheduler; for (int i = 0; i < numBuffers; i++) { this.m_buffers[i] = this.CreateBuffer(size); } }
public DisplacementBufferCPU(int size, Scheduler scheduler) : base(size, NUM_BUFFERS, scheduler) { int GRIDS = QueryDisplacements.GRIDS; int CHANNELS = QueryDisplacements.CHANNELS; m_displacements = new List<InterpolatedArray2f[]>(2); m_displacements.Add( new InterpolatedArray2f[GRIDS] ); m_displacements.Add( new InterpolatedArray2f[GRIDS] ); for (int i = 0; i < GRIDS; i++) { m_displacements[0][i] = new InterpolatedArray2f(size, size, CHANNELS, true); m_displacements[1][i] = new InterpolatedArray2f(size, size, CHANNELS, true); } }
void Start() { try { //Zero all textures Shader.SetGlobalTexture("Ceto_SlopeMap0", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_SlopeMap1", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_DisplacementMap0", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_DisplacementMap1", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_DisplacementMap2", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_DisplacementMap3", Texture2D.blackTexture); Shader.SetGlobalTexture("Ceto_FoamMap0", Texture2D.blackTexture); m_slopeCopyMat = new Material(slopeCopySdr); m_displacementCopyMat = new Material(displacementCopySdr); m_foamCopyMat = new Material(foamCopySdr); m_slopeInitMat = new Material(initSlopeSdr); m_displacementInitMat = new Material(initDisplacementSdr); m_foamInitMat = new Material(initJacobianSdr); m_conditionCache = new DictionaryQueue<WaveSpectrumConditionKey, WaveSpectrumCondition>(); m_scheduler = new Scheduler(); CreateBuffers(); CreateRenderTextures(); CreateConditions(); UpdateQueryScaling(); } catch(Exception e) { Ocean.LogError(e.ToString()); WasError = true; enabled = false; } }
void Awake() { try { #if CETO_DEBUG_SCHEDULER LogInfo("Debug scheduler is on"); #endif //There can only be one ocean in a scene if (Instance != null) { throw new InvalidOperationException("There can only be one ocean instance."); } else { Instance = this; } WindDirVector = CalculateWindDirVector(); if(doublePrecisionProjection) Projection = new Projection3d(this); else Projection = new Projection3f(this); OceanTime = new OceanTime(); m_waveOverlayMat = new Material(waveOverlaySdr); OverlayManager = new OverlayManager( m_waveOverlayMat); m_scheduler = new Scheduler(); } catch(Exception e) { LogError(e.ToString()); DisableOcean(); } }