Skip to content

Commit

Permalink
add option to display performance data
Browse files Browse the repository at this point in the history
  • Loading branch information
tappi287 committed Nov 23, 2020
1 parent ec8da39 commit 7a041cf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 18 deletions.
37 changes: 26 additions & 11 deletions modules/settings_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
},
'Special FX': {'name': 'Special Effects', 'value': 4,
'settings':
({'value': 0, 'name': 'Off'}, {'value': 1, 'name': 'Low'},
{'value': 2, 'name': 'Medium'}, {'value': 3, 'name': 'High'}, {'value': 4, 'name': 'Ultra'}),
({'value': 0, 'name': 'Off'},
{'value': 1, 'name': 'Low', 'perf': 'G+0,18% C+0,00%'},
{'value': 2, 'name': 'Medium'}, {'value': 3, 'name': 'High'},
{'value': 4, 'name': 'Ultra', 'perf': 'G+0,90% C+2,20%'}),
},
'Shadows': {'name': 'Shadows', 'value': 3,
'settings':
Expand All @@ -54,30 +56,43 @@
'Soft Particles': {'name': 'Soft Particles', 'value': 1,
'settings':
({'value': 0, 'name': 'Off'}, {'value': 1, 'name': 'Low', 'desc': 'Cheap soft edges'},
{'value': 2, 'name': 'High', 'desc': 'Depth buffered soft edges'}),
{'value': 2, 'name': 'High', 'desc': 'Depth buffered soft edges',
'perf': 'G+0,57% C+2,57%'}),
},
'Rain FX Quality': {'name': 'Rain Drops', 'value': 3,
'settings':
({'value': 1, 'name': 'Off'}, {'value': 2, 'name': 'Low'},
({'value': 1, 'name': 'Off', 'desc': 'Anything else than off will have a massive '
'performance impact!'},
{'value': 2, 'name': 'Low', 'perf': 'G+4,10% C+6,30%'},
{'value': 3, 'name': 'Medium'}, {'value': 4, 'name': 'High'},
{'value': 5, 'name': 'Ultra'}),
{'value': 5, 'name': 'Ultra', 'perf': 'G+17,2% C+6,70%'}),
},
'Road Reflections': {'name': 'Road Reflection', 'value': 2,
'settings':
({'value': 0, 'name': 'Off'},
({'value': 0, 'name': 'Off',
'desc': 'It will be hard to spot wet track areas! '
'The Low setting is free on GPU but CPU heavy'},
{'value': 1, 'name': 'Low',
'desc': 'Reflected objects are generated for wet road and heat mirage'},
'desc': 'Reflected objects are generated '
'for wet road and heat mirage',
'perf': 'G+0,33% C+5,39%'},
{'value': 2, 'name': 'High',
'desc': 'Reflected objects are generated for wet road and heat mirage'},
{'value': 3, 'name': 'Ultra', 'desc': 'Adds reflection blurring'}),
{'value': 3, 'name': 'Ultra',
'desc': 'Adds reflection blurring',
'perf': 'G+6,40% C+9,40%'}),
},
'Environment Reflections': {'name': 'Environment Reflection', 'value': 2,
'settings':
({'value': 0, 'name': 'Off'},
{'value': 1, 'name': 'Low',
'desc': 'Live cubic mapping is used (if track and car are setup properly)'},
'desc': 'Live cubic mapping is used '
'(if track and car are setup properly)',
'perf': 'G+0,00% C+0,00%'},
{'value': 2, 'name': 'High',
'desc': 'Live cubic mapping is used (if track and car are setup properly)'}),
'desc': 'Live cubic mapping is used '
'(if track and car are setup properly)',
'perf': 'G+3,39% C+4,45%'}),
},
}

Expand All @@ -100,7 +115,7 @@
'desc': 'rFactor 2 default setting: 12'}, )},
'Rearview Particles': {'name': 'Rearview Particles', 'value': True,
'settings': ({'value': False, 'name': 'Disabled'},
{'value': True, 'name': 'Enabled [Default]',
{'value': True, 'name': 'Enabled [Default]', 'perf': 'G+3,30% C+1,44%',
'desc': 'Show particles like rain spray in the rear view mirror'})
},
'Rearview_Back_Clip': {'name': 'Rearview Back Clip', 'value': 0,
Expand Down
23 changes: 19 additions & 4 deletions vue/src/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
<template #header>
<h6 class="mb-0"><span class="title">{{ preset.video_settings.title }}</span></h6>
</template>
<!-- View Mode Grid-->
<Setting v-for="setting in preset.video_settings.options" :key="setting.key"
:setting="setting" variant="rf-orange" class="mr-3" group_id="video"
:show_performance="showPerformance"
v-on:setting-changed="updateSetting">
</Setting>
<!-- Footer -->
Expand All @@ -101,20 +101,33 @@
<b-card v-if="selectedPresetIdx === idx" class="mt-3" id="graphic"
bg-variant="dark" text-variant="white">
<template #header>
<h6 class="mb-0"><span class="title">{{ preset.graphic_options.title }}</span></h6>
<h6 class="mb-0">
<span class="title">{{ preset.graphic_options.title }}</span>
<div class="float-right">
<b-button size="sm" @click="showPerformance = !showPerformance"
v-b-popover.lefttop.hover="'Show performance data next to supported settings in ' +
'the dropdown menu. ' +
'G=relative GPU performance impact | C=relative CPU performance impact'">
<b-icon :icon="showPerformance ? 'graph-up' : 'graph-down'"></b-icon>
</b-button>
</div>
</h6>
</template>
<template v-if="!viewMode">
<!-- View Mode Grid -->
<Setting v-for="setting in preset.graphic_options.options" :key="setting.key"
:setting="setting" variant="rf-orange" class="mr-3 mb-3" :fixWidth="true"
group_id="graphic"
group_id="graphic" :show_performance="showPerformance"
v-on:setting-changed="updateSetting">
</Setting>
</template>
<template v-else>
<!-- View Mode List -->
<b-list-group class="text-left">
<b-list-group-item class="bg-transparent" v-for="setting in preset.graphic_options.options"
:key="setting.key">
<Setting :setting="setting" variant="rf-orange" :fixWidth="true" group_id="graphic"
:show_performance="showPerformance"
v-on:setting-changed="updateSetting">
</Setting>
</b-list-group-item>
Expand All @@ -129,6 +142,7 @@
</template>
<Setting v-for="setting in preset.advanced_graphic_options.options" :key="setting.key"
:setting="setting" variant="rf-orange" group_id="advanced" class="mr-3 mb-3" :fixWidth="true"
:show_performance="showPerformance"
v-on:setting-changed="updateSetting">
</Setting>
<template #footer><span class="small font-weight-lighter">More settings available soon</span></template>
Expand Down Expand Up @@ -179,7 +193,8 @@ export default {
viewMode: 0,
previousPresetName: '',
error: '',
settingsAreaId: settingsAreaId
settingsAreaId: settingsAreaId,
showPerformance: false,
}
},
methods: {
Expand Down
10 changes: 7 additions & 3 deletions vue/src/components/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class="setting-item fixed-width-setting">
<b-dropdown-item v-for="s in setting.settings" :key="s.value"
@click="selectSetting(s)">
{{ s.name }}
{{ s.name }}<template v-if="showPerformance && s.perf !== undefined"> {{ s.perf }}</template>
<b-icon v-if="s.desc !== undefined" icon="info-square"
v-b-popover.hover.left="s.desc">
class="ml-2" v-b-popover.hover.left="s.desc">
</b-icon>
</b-dropdown-item>
</b-dropdown>
Expand Down Expand Up @@ -97,7 +97,7 @@ export default {
},
},
props: {
setting: Object, variant: String, fixWidth: Boolean, group_id: String
setting: Object, variant: String, fixWidth: Boolean, group_id: String, show_performance: Boolean
},
created: function () {
// Check Setting Type
Expand Down Expand Up @@ -134,6 +134,10 @@ export default {
})
return name
},
showPerformance: function () {
if (this.show_performance !== undefined) { return this.show_performance }
return false
},
settingHidden: function () {
if (this.setting === undefined) { return true }
return this.setting['hidden'] || false
Expand Down

0 comments on commit 7a041cf

Please sign in to comment.