<p dir="auto">It's useful for editors &amp; data files to be able to enumerate constants. So instead of having <code class="notranslate">"wrapS" : 1000</code> you can write <code class="notranslate">"wrapS" : "RepeatWrapping"</code>, or if you want to construct a drop down for all the different texture filter modes etc. What seems to be the best approach at the moment is to copy &amp; paste <code class="notranslate">TEXTURE_FILTER</code>, I think it would be better if they were just exported as is instead. Not only is it a whole lot cleaner than copy &amp; paste, but it also guarantees that they're in sync if new ones ever gets added or if it's changed.</p>
<p dir="auto">Next to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="271087991" data-permission-text="Title is private" data-url="https://github.com/mrdoob/three.js/issues/12574" data-hovercard-type="issue" data-hovercard-url="/mrdoob/three.js/issues/12574/hovercard" href="https://github.com/mrdoob/three.js/issues/12574">#12574</a> part 2</p>
<p dir="auto">The proposal is to use "enum like" object instead of wild constantes, this will prevent user against change them by error. And gain in readability about what values are usable in the same 'enum'</p>
<p dir="auto">Example:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// RENDERER
var CullFace = Object.freeze( {
    None: 0, 
    Back: 1, 
    ...
} );

// MATERIALS
var MaterialSide = Object.freeze( {
    Front: 0, 
    Back: 1, 
    ...
} );

// TEXTURES
var TextureMapping = Object.freeze( {
    UV: 0, 
    CubeReflection: 1, 
    ...
} );

..."><pre class="notranslate"><span class="pl-c">// RENDERER</span>
<span class="pl-k">var</span> <span class="pl-v">CullFace</span> <span class="pl-c1">=</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">freeze</span><span class="pl-kos">(</span> <span class="pl-kos">{</span>
    <span class="pl-c1">None</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span> 
    <span class="pl-c1">Back</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span> 
    ...
<span class="pl-kos">}</span> <span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// MATERIALS</span>
<span class="pl-k">var</span> <span class="pl-v">MaterialSide</span> <span class="pl-c1">=</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">freeze</span><span class="pl-kos">(</span> <span class="pl-kos">{</span>
    <span class="pl-c1">Front</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span> 
    <span class="pl-c1">Back</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span> 
    ...
<span class="pl-kos">}</span> <span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// TEXTURES</span>
<span class="pl-k">var</span> <span class="pl-v">TextureMapping</span> <span class="pl-c1">=</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">freeze</span><span class="pl-kos">(</span> <span class="pl-kos">{</span>
    <span class="pl-c1">UV</span>: <span class="pl-c1">0</span><span class="pl-kos">,</span> 
    <span class="pl-c1">CubeReflection</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span> 
    ...
<span class="pl-kos">}</span> <span class="pl-kos">)</span><span class="pl-kos">;</span>

...</pre></div>
<p dir="auto">instead of</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export var RepeatWrapping = 1000;
export var ClampToEdgeWrapping = 1001;
export var MirroredRepeatWrapping = 1002;  &lt;= dude ! I need a new wrapping type
export var NearestFilter = 1003;
export var NearestMipMapNearestFilter = 1004;
export var NearestMipMapLinearFilter = 1005;
export var LinearFilter = 1006;
export var LinearMipMapNearestFilter = 1007;
export var LinearMipMapLinearFilter = 1008;  &lt;= Or damned, i need a new filter type, i will need to increase all type bellow...
export var UnsignedByteType = 1009;
export var ByteType = 1010;
export var ShortType = 1011;
export var UnsignedShortType = 1012;"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-v">RepeatWrapping</span> <span class="pl-c1">=</span> <span class="pl-c1">1000</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-v">ClampToEdgeWrapping</span> <span class="pl-c1">=</span> <span class="pl-c1">1001</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-v">MirroredRepeatWrapping</span> <span class="pl-c1">=</span> <span class="pl-c1">1002</span><span class="pl-kos">;</span>  <span class="pl-c1">&lt;</span><span class="pl-c1">=</span> <span class="pl-s1">dude</span> <span class="pl-c1">!</span> <span class="pl-c1">I</span> <span class="pl-c1">need</span> <span class="pl-c1">a</span> <span class="pl-c1">new</span> <span class="pl-c1">wrapping</span> <span class="pl-c1">type</span>
<span class="pl-c1">export</span> <span class="pl-c1">var</span> <span class="pl-c1">NearestFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1003</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">NearestMipMapNearestFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1004</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">NearestMipMapLinearFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1005</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">LinearFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1006</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">LinearMipMapNearestFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1007</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">LinearMipMapLinearFilter</span> <span class="pl-c1">=</span> <span class="pl-c1">1008</span><span class="pl-kos">;</span>  <span class="pl-c1">&lt;=</span> <span class="pl-c1">Or</span> <span class="pl-c1">damned</span><span class="pl-kos">,</span> <span class="pl-c1">i</span> <span class="pl-c1">need</span> <span class="pl-c1">a</span> <span class="pl-c1">new</span> <span class="pl-c1">filter</span> <span class="pl-c1">type</span><span class="pl-kos">,</span> <span class="pl-c1">i</span> <span class="pl-c1">will</span> <span class="pl-c1">need</span> <span class="pl-c1">to</span> <span class="pl-c1">increase</span> <span class="pl-c1">all</span> <span class="pl-c1">type</span> <span class="pl-c1">bellow</span><span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-kos">.</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">UnsignedByteType</span> <span class="pl-c1">=</span> <span class="pl-c1">1009</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">ByteType</span> <span class="pl-c1">=</span> <span class="pl-c1">1010</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-c1">ShortType</span> <span class="pl-c1">=</span> <span class="pl-c1">1011</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">var</span> <span class="pl-v">UnsignedShortType</span> <span class="pl-c1">=</span> <span class="pl-c1">1012</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">and the call become:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="material.blending = THREE.Blending.Normal"><pre class="notranslate"><span class="pl-s1">material</span><span class="pl-kos">.</span><span class="pl-c1">blending</span> <span class="pl-c1">=</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">Blending</span><span class="pl-kos">.</span><span class="pl-c1">Normal</span></pre></div>
<p dir="auto">instead of</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="material.blending = THREE.NormalBlending"><pre class="notranslate"><span class="pl-s1">material</span><span class="pl-kos">.</span><span class="pl-c1">blending</span> <span class="pl-c1">=</span> <span class="pl-c1">THREE</span><span class="pl-kos">.</span><span class="pl-c1">NormalBlending</span></pre></div>