added base rotation + git links

This commit is contained in:
gbrochar 2020-11-25 13:45:25 +01:00
parent e568664fa7
commit ca293366fb
2 changed files with 19 additions and 4 deletions

View File

@ -248,6 +248,7 @@ async function main() {
y: $('#roty').val(),
z: $('#rotz').val(),
},
rotSpeed: $('#rotspeed').val(),
};
const [
@ -378,6 +379,10 @@ async function main() {
const rotz: any = $('#rotz').val();
params.rot.z = parseFloat(rotz);
});
$('#rotspeed').on('input', function() {
const rotSpeed: any = $('#rotspeed').val();
params.rotSpeed = parseFloat(rotSpeed);
});
$('#fov').on('input', function() {
const fov: any = $('#fov').val();
params.fov = parseFloat(fov);
@ -510,6 +515,9 @@ function drawScene(gl: any,
-params.avg.y,
-params.avg.z,
]);
mat4.rotateY(modelMatrix,
modelMatrix,
squareRotation);
// Set the drawing position to the "identity" point, which is
// the center of the scene.
@ -621,5 +629,5 @@ function drawScene(gl: any,
gl.drawElements(gl.TRIANGLES, vertexCount, type, offset);
}
squareRotation += deltaTime;
squareRotation += deltaTime * params.rotSpeed;
}

View File

@ -33,14 +33,18 @@
<div style='display: inline;'>Change fov : </div>
<input type="range" min="15" max="150" value="45" class="slider" id="fov">
</div>
<div class='ui-block'>
<div style='display: inline;'>Change base rotation speed : </div>
<input type="range" min="0" max="5" value="1" step='0.0001' class="slider" id="rotspeed">
</div>
<div class='ui-block'>
<div style='display: inline;'>Change rotation : </div>
<div style='display: inline;'>X: </div>
<input type="range" min="0" max="6.2830" value="0.5" step='0.0001' class="slider" id="rotx">
<input type="range" min="0" max="6.2830" value="0" step='0.0001' class="slider" id="rotx">
<div style='display: inline;'>Y: </div>
<input type="range" min="0" max="6.2830" value="0.8" step='0.01' class="slider" id="roty">
<input type="range" min="0" max="6.2830" value="0" step='0.0001' class="slider" id="roty">
<div style='display: inline;'>Z: </div>
<input type="range" min="0" max="6.2830" value="1" step='0.01' class="slider" id="rotz">
<input type="range" min="0" max="6.2830" value="0" step='0.0001' class="slider" id="rotz">
</div>
<div class='ui-block'>
<button id='o_sphere'>Set object to sphere</button>
@ -58,6 +62,9 @@
<button id='t_racer_wireframe'>Set texture to racer wireframe</button>
</div>
<div class='ui-block'>
<a href='https://git.gaetanbrochard.dev/gbrochar/webgl'>This project's git</a>
<br>
<a href='https://git.gaetanbrochard.dev/gbrochar'>My git</a>
<p>If you're on mobile, you need to set the shader to texture or sobel to change object, then you can change the shader</p>
</div>
</div>