From 496894ecced1b0a4ae5ab176902bbd0f43a31ed1 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 24 Oct 2014 12:56:30 -0700 Subject: Updating to 0.4.3 SDK --- Samples/CommonSrc/Util/OptionMenu.cpp | 19 ++++++++++++++++--- Samples/CommonSrc/Util/OptionMenu.h | 2 +- Samples/CommonSrc/Util/RenderProfiler.cpp | 13 +++++++------ Samples/CommonSrc/Util/RenderProfiler.h | 8 ++++---- 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'Samples/CommonSrc/Util') diff --git a/Samples/CommonSrc/Util/OptionMenu.cpp b/Samples/CommonSrc/Util/OptionMenu.cpp index 2d3c3d0..b2cc0c9 100644 --- a/Samples/CommonSrc/Util/OptionMenu.cpp +++ b/Samples/CommonSrc/Util/OptionMenu.cpp @@ -5,7 +5,7 @@ Content : Option selection and editing for OculusWorldDemo Created : March 7, 2014 Authors : Michael Antonov, Caleb Leak -Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2012 Oculus VR, LLC All Rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -150,6 +150,7 @@ OptionVar::OptionVar(const char* name, void* pvar, VarType type, ShortcutDown.pNotify = new FunctionNotifyContext(this, &OptionVar::PrevValue); } + OptionVar::OptionVar(const char* name, int32_t* pvar, int32_t min, int32_t max, int32_t stepSize, const char* formatString, @@ -164,6 +165,11 @@ OptionVar::OptionVar(const char* name, int32_t* pvar, pNotify = 0; FormatString= formatString; + MaxFloat = MATH_FLOAT_MAXVALUE; + MinFloat = -MATH_FLOAT_MAXVALUE; + StepFloat = 1.0f; + FormatScale = 1.0f; + MinInt = min; MaxInt = max; StepInt = stepSize; @@ -194,6 +200,10 @@ OptionVar::OptionVar(const char* name, float* pvar, StepFloat = stepSize; FormatScale = formatScale; + MaxInt = 0x7FFFFFFF; + MinInt = -(MaxInt) - 1; + StepInt = 1; + SelectedIndex = 0; ShortcutUp.pNotify = new FunctionNotifyContext(this, &OptionVar::NextValue); @@ -243,9 +253,12 @@ void OptionVar::PrevValue(bool* pFastStep) switch (Type) { case Type_Enum: - *AsInt() = ((GetEnumIndex() + (uint32_t)EnumValues.GetSize() - 1) % EnumValues.GetSize()); + { + uint32_t size = (uint32_t)(EnumValues.GetSize() ? EnumValues.GetSize() : 1); + *AsInt() = ((GetEnumIndex() + (size - 1)) % size); break; - + } + case Type_Int: *AsInt() = Alg::Max(*AsInt() - StepInt * (fastStep ? 5 : 1), MinInt); break; diff --git a/Samples/CommonSrc/Util/OptionMenu.h b/Samples/CommonSrc/Util/OptionMenu.h index 5eea9bd..0c3c289 100644 --- a/Samples/CommonSrc/Util/OptionMenu.h +++ b/Samples/CommonSrc/Util/OptionMenu.h @@ -5,7 +5,7 @@ Content : Option selection and editing for OculusWorldDemo Created : March 7, 2014 Authors : Michael Antonov, Caleb Leak -Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2012 Oculus VR, LLC All Rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Samples/CommonSrc/Util/RenderProfiler.cpp b/Samples/CommonSrc/Util/RenderProfiler.cpp index 00bbdd9..cc617ff 100644 --- a/Samples/CommonSrc/Util/RenderProfiler.cpp +++ b/Samples/CommonSrc/Util/RenderProfiler.cpp @@ -5,7 +5,7 @@ Content : Profiling for render. Created : March 10, 2014 Authors : Caleb Leak -Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2012 Oculus VR, LLC All Rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -76,18 +76,19 @@ void RenderProfiler::DrawOverlay(RenderDevice* prender) const double* averages = GetAverages(); const double* lastSampleSet = GetLastSampleSet(); - for ( int timerNum = 1; timerNum < Sample_LAST; timerNum++ ) + static_assert((Sample_FrameStart == 0) && (Sample_AfterGameProcessing == 1) && (Sample_AfterPresent + 1 == Sample_LAST), "The following code depends on SampleType enum values."); + + for ( int timerNum = Sample_AfterGameProcessing; timerNum < Sample_LAST; timerNum++ ) { char const *pName = ""; switch ( timerNum ) { case Sample_AfterGameProcessing: pName = "AfterGameProcessing"; break; case Sample_AfterEyeRender : pName = "AfterEyeRender "; break; -// case Sample_BeforeDistortion : pName = "BeforeDistortion "; break; -// case Sample_AfterDistortion : pName = "AfterDistortion "; break; + //case Sample_BeforeDistortion : pName = "BeforeDistortion "; break; This enumerant is currently disabled in the enumeration declaration. + //case Sample_AfterDistortion : pName = "AfterDistortion "; break; case Sample_AfterPresent : pName = "AfterPresent "; break; -// case Sample_AfterFlush : pName = "AfterFlush "; break; - default: OVR_ASSERT ( false ); + //case Sample_AfterFlush : pName = "AfterFlush "; break; } char bufTemp[256]; OVR_sprintf ( bufTemp, sizeof(bufTemp), "\nRaw: %.2lfms\t400Ave: %.2lfms\t800%s", diff --git a/Samples/CommonSrc/Util/RenderProfiler.h b/Samples/CommonSrc/Util/RenderProfiler.h index 7494034..84e5013 100644 --- a/Samples/CommonSrc/Util/RenderProfiler.h +++ b/Samples/CommonSrc/Util/RenderProfiler.h @@ -5,7 +5,7 @@ Content : Profiling for render. Created : March 10, 2014 Authors : Caleb Leak -Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2012 Oculus VR, LLC All Rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -43,10 +43,10 @@ public: Sample_FrameStart , Sample_AfterGameProcessing , Sample_AfterEyeRender , - // Sample_BeforeDistortion , - // Sample_AfterDistortion , + //Sample_BeforeDistortion , + //Sample_AfterDistortion , Sample_AfterPresent , - // Sample_AfterFlush , + //Sample_AfterFlush , Sample_LAST }; -- cgit v1.2.3