Editing
CMathRemap
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Overview == Accepts an input value which is remapped from it's relationship with the internal min and max input values, to a correlating relationship with the internal min and max output values. For example, here are values used to scale an input by 10: * Input min (m_flInMin) - 0 * Input max (m_flInMax) - 10 * Output min (m_flOut1) - 0 * Output max (m_flOut2) - 100 Sending an InValue of 5 will result in an OutValue of 50, an InValue of 10 will produce an OutValue of 100, etc. Here is the full formula used in the code, flValue is the input value: <syntaxhighlight lang="c++"> float flRemappedValue = m_flOut1 + (((flValue - m_flInMin) * (m_flOut2 - m_flOut1)) / (m_flInMax - m_flInMin)); </syntaxhighlight> '''Source location : [https://github.com/sreechar/TF2-Source-Code/tree/master/tf2_src/game/server/logicentities.cpp /game/server/logicentities.cpp]''' '''Linked Entity : [https://developer.valvesoftware.com/wiki/math_remap math_remap]''' ==[[Classes|Class Structure]]== *'''[[CBaseEntity]]''' **'''[[CServerOnlyEntity]]''' ***'''[[CLogicalEntity]]''' ****'''CMathRemap''' == Entity DataMaps == {| class="wikitable sortable mw-collapsible mw-collapsed" style="margin: 0 auto; width: 100%; padding: 0; |+CMathRemap ! style="width: 50%; background-color: #303030; color: white" |Name ! style="width: 15%; background-color: #303030; color: white" |Type ! style="width: 35%; background-color: #303030; color: white" |Description |- | style="width: 50%;" |'''InputDisable''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''InputEnable''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''InputValue''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_OutValue''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_bEnabled''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_flInMax''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_flInMin''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_flOut1''' | style="width: 15%;" | | style="width: 35%;" | |- | style="width: 50%;" |'''m_flOut2''' | style="width: 15%;" | | style="width: 35%;" | |}
Summary:
Please note that all contributions to SigMod are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
SigMod:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
Edit source
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information