321_hw2_reg_ex Due Date: Nov XXXXXXXXXX, 11:59 Assignment 2 Please do the following process in your Linux system. The assignment 2 is continuous assignment of assignment 1. Most of following steps can...

1 answer below »
complete>?


321_hw2_reg_ex Due Date: Nov 28 2020, 11:59 Assignment 2 Please do the following process in your Linux system. The assignment 2 is continuous assignment of assignment 1. Most of following steps can be done using single command, I recommend you to use single command. 1. Display files and folder in your root directory which we created in assignment 1. This step should display every files and folders from each level of file system. 2. Find every file ends with “.py” or “.txt” or “.cpp” from your root directory, and list the detail of each file. 3. Find every line that contains two or more space in every file in “Folder1” include subdirectory. (Not only consecutive two or more space) 4. Find every line that contains two or more “<” symbol="" in="" “folder2”="" include="" subdirectory.="" (not="" only="" consecutive="" two="" or="" more=""><” symbol) 5. find every line that contains parentheses inside parentheses in “folder3” include subdirectory, such as print(type(6*2)). 6. find every line that contains at least two digits in folder “folder1”, “folder2” and “folder3” include subdirectory. the two digits can be two separate digit, such as “1.5” or “1 and 2”. 7. find every line that start with “}” or ends with “{” in “folder2” include subdirectory. example: “int main(){” or “}”. 8. find every line that contains any pair of repeated words in folder “folder1”, “folder2” and “folder3” include subdirectory. example: a + a, b b, c d c d. (the command should be able to find the ‘c = a + “ ” + b’) 9. list every filename contains at least two digits from folder “folder1”, “folder2” and “folder3” include subdirectory. 10. list every filename contains a number that greater than 11 and less than 22 from folder “folder1”, “folder2” and “folder3” include subdirectory. submission requirement: please take the screenshot of every step you do in your computer, so i can check you did the right process. please also submit use either word file or pdf file, do not submit in any other file format since there can be readability issue. due date: nov 28 2020, 11:59 please keep all the files and directory in you computer, we will use same file system for next assignment. you may need to create these files and directories again if you remove them from your computer. late penalty: 20pt / day i will keep the assignment 2 available to you 5 days after due date, then it will disappear from you blackboard. (it is actually 0 if you submit assignment more than 5 days late.) symbol)="" 5.="" find="" every="" line="" that="" contains="" parentheses="" inside="" parentheses="" in="" “folder3”="" include="" subdirectory,="" such="" as="" print(type(6*2)).="" 6.="" find="" every="" line="" that="" contains="" at="" least="" two="" digits="" in="" folder="" “folder1”,="" “folder2”="" and="" “folder3”="" include="" subdirectory.="" the="" two="" digits="" can="" be="" two="" separate="" digit,="" such="" as="" “1.5”="" or="" “1="" and="" 2”.="" 7.="" find="" every="" line="" that="" start="" with="" “}”="" or="" ends="" with="" “{”="" in="" “folder2”="" include="" subdirectory.="" example:="" “int="" main(){”="" or="" “}”.="" 8.="" find="" every="" line="" that="" contains="" any="" pair="" of="" repeated="" words="" in="" folder="" “folder1”,="" “folder2”="" and="" “folder3”="" include="" subdirectory.="" example:="" a="" +="" a,="" b="" b,="" c="" d="" c="" d.="" (the="" command="" should="" be="" able="" to="" find="" the="" ‘c="a" +="" “="" ”="" +="" b’)="" 9.="" list="" every="" filename="" contains="" at="" least="" two="" digits="" from="" folder="" “folder1”,="" “folder2”="" and="" “folder3”="" include="" subdirectory.="" 10.="" list="" every="" filename="" contains="" a="" number="" that="" greater="" than="" 11="" and="" less="" than="" 22="" from="" folder="" “folder1”,="" “folder2”="" and="" “folder3”="" include="" subdirectory.="" submission="" requirement:="" please="" take="" the="" screenshot="" of="" every="" step="" you="" do="" in="" your="" computer,="" so="" i="" can="" check="" you="" did="" the="" right="" process.="" please="" also="" submit="" use="" either="" word="" file="" or="" pdf="" file,="" do="" not="" submit="" in="" any="" other="" file="" format="" since="" there="" can="" be="" readability="" issue.="" due="" date:="" nov="" 28="" 2020,="" 11:59="" please="" keep="" all="" the="" files="" and="" directory="" in="" you="" computer,="" we="" will="" use="" same="" file="" system="" for="" next="" assignment.="" you="" may="" need="" to="" create="" these="" files="" and="" directories="" again="" if="" you="" remove="" them="" from="" your="" computer.="" late="" penalty:="" 20pt="" day="" i="" will="" keep="" the="" assignment="" 2="" available="" to="" you="" 5="" days="" after="" due="" date,="" then="" it="" will="" disappear="" from="" you="" blackboard.="" (it="" is="" actually="" 0="" if="" you="" submit="" assignment="" more="" than="" 5="" days="">
Answered Same DayNov 19, 2021

Answer To: 321_hw2_reg_ex Due Date: Nov XXXXXXXXXX, 11:59 Assignment 2 Please do the following process in your...

Sandeep Kumar answered on Nov 29 2021
151 Votes
"use strict";
let cubeRotation = 0.0;
function main() {
/** @type {HTMLCanvasElement} */
const canvas = document.getElementById("canvas");
/** @type {WebGL2RenderingContext} */
const gl = canvas.getContext("webgl");
if (!gl) {
alert("Please use a modern web browser, as your current one does not support WebGL.");
}

gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
const vertexShaderSource = `
attribute vec4 aVertexPos
ition;
attribute vec3 aVertexNormal;
attribute vec2 aTextureCoord;
uniform mat4 uNormalMatrix;
uniform mat4 uModelViewMatrix;
uniform mat4 uProjectionMatrix;
varying highp vec2 vTextureCoord;
varying highp vec3 vLighting;
void main(void) {
gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition;
vTextureCoord = aTextureCoord;
// Apply lighting
highp vec3 ambientLight = vec3(0.3, 0.3, 0.3);
highp vec3 directionalLightColor = vec3(1, 1, 1);
highp vec3 directionalVector = normalize(vec3(0.85, 0.8, 0.75));
highp vec4 transformedNormal = uNormalMatrix * vec4(aVertexNormal, 1.0);
highp float directional = max(dot(transformedNormal.xyz, directionalVector), 0.0);
vLighting = ambientLight + (directionalLightColor * directional);
}
`;
const fragmentShaderSource = `
varying highp vec2 vTextureCoord;
varying highp vec3 vLighting;
uniform sampler2D uSampler;

void main(void) {
highp vec4 texelColor = texture2D(uSampler, vTextureCoord);
gl_FragColor = vec4(texelColor.rgb * vLighting, texelColor.a);
}
`;
// Initialize shader program
const shaderProgram = initShaderProgram(gl, vertexShaderSource, fragmentShaderSource);
const programInfo = {
program: shaderProgram,
attribLocations: {
vertexPosition: gl.getAttribLocation(shaderProgram, "aVertexPosition"),
vertexNormal: gl.getAttribLocation(shaderProgram, "aVertexNormal"),
textureCoord: gl.getAttribLocation(shaderProgram, "aTextureCoord"),
},
uniformLocations: {
modelViewMatrix: gl.getUniformLocation(shaderProgram, "uModelViewMatrix"),
projectionMatrix: gl.getUniformLocation(shaderProgram, "uProjectionMatrix"),
normalMatrix: gl.getUniformLocation(shaderProgram, "uNormalMatrix"),
uSampler: gl.getUniformLocation(shaderProgram, "uSampler"),
}
};
const buffers = initBuffers(gl);
const texture = loadTexture(gl, "./assets/wood-texture.jpg");
let then = 0;
// Draw the scene repeatedly to the gl canvas
function render(now) {
now *= 0.001; // convert to seconds
const deltaTime = now - then;
then = now;
drawScene(gl, programInfo, buffers, texture, deltaTime);
requestAnimationFrame(render);
}
requestAnimationFrame(render);
}
function initBuffers(/** @type {WebGL2RenderingContext} */gl) {
// Create a buffer for the square's positions.
const positionBuffer = gl.createBuffer();
// Select the positionBuffer as the one to apply buffer operations to from here on.
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
// Now, create an array of positions for the square.
const positions = [
// Front face
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
1.0, 1.0, 1.0,
-1.0, 1.0, 1.0,
// Back face
-1.0, -1.0, -1.0,
-1.0, 1.0, -1.0,
1.0, 1.0, -1.0,
1.0, -1.0, -1.0,
// Top face
-1.0, 1.0, -1.0,
-1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, -1.0,

// Bottom face
-1.0, -1.0, -1.0,
1.0, -1.0, -1.0,
1.0, -1.0, 1.0,
-1.0, -1.0, 1.0,

// Right face
1.0, -1.0, -1.0,
1.0, 1.0, -1.0,
1.0, 1.0, 1.0,
1.0, -1.0, 1.0,

// Left face
-1.0, -1.0, -1.0,
-1.0, -1.0, 1.0,
-1.0, 1.0, 1.0,
-1.0, 1.0, -1.0,
];
/*
Now, pass the list of positions into WebGL to build
the shape. We do this by creating a Float32Array from the
JS array, then use it to fill the current buffer.
*/
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array(positions),
gl.STATIC_DRAW
);
// Set up the normals for the vertices, so that we can compute lighting.
const normalBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, normalBuffer);
const vertexNormals = [
// Front
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
// Back
0.0, 0.0, -1.0,
0.0, 0.0, -1.0,
0.0, 0.0, -1.0,
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here