Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebGL Tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiyoon Park
WebGL Tutorial
Commits
ee6fe81b
Commit
ee6fe81b
authored
3 years ago
by
Jiyoon Park
Browse files
Options
Downloads
Patches
Plain Diff
add: lookat func
parent
a17ea902
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.html
+33
-9
33 additions, 9 deletions
index.html
script.js
+77
-2
77 additions, 2 deletions
script.js
temp.js
+0
-1373
0 additions, 1373 deletions
temp.js
with
110 additions
and
1384 deletions
index.html
+
33
−
9
View file @
ee6fe81b
...
...
@@ -91,17 +91,41 @@
<br/><hr>
<label>
lookAt |
</label>
<br/>
<label>
eye vector :
</label>
<input
style=
"width:400px"
id=
"x_
mov
e"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_x
mov
e(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textX
Mov
e"
value=
"0"
>
<label>
eye vector
(x-axis)
:
</label>
<input
style=
"width:400px"
id=
"x_
ey
e"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_x
ey
e(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textX
Ey
e"
value=
"0"
>
<br/>
<label>
Y
-axis
:
</label>
<input
style=
"width:400px"
id=
"y_
mov
e"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_y
mov
e(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textY
Mov
e"
value=
"0"
>
<label>
eye vector (y
-axis
)
:
</label>
<input
style=
"width:400px"
id=
"y_
ey
e"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_y
ey
e(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textY
Ey
e"
value=
"0"
>
<br/>
<label>
Z-axis Move :
</label>
<input
style=
"width:400px"
id=
"z_move"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_zmove(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textZMove"
value=
"0"
>
<label>
eye vector (z-axis) :
</label>
<input
style=
"width:400px"
id=
"z_eye"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_zeye(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textZEye"
value=
"2"
>
<br/><hr>
<label>
center vector (x-axis) :
</label>
<input
style=
"width:400px"
id=
"x_center"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_xcenter(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textXCenter"
value=
"0"
>
<br/>
<label>
center vector (y-axis) :
</label>
<input
style=
"width:400px"
id=
"y_center"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_ycenter(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textYCenter"
value=
"0"
>
<br/>
<label>
center vector (z-axis) :
</label>
<input
style=
"width:400px"
id=
"z_center"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_zcenter(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textZCenter"
value=
"0"
>
<br/><hr>
<label>
up vector (x-axis) :
</label>
<input
style=
"width:400px"
id=
"x_up"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_xup(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textXUp"
value=
"0"
>
<br/>
<label>
up vector (y-axis) :
</label>
<input
style=
"width:400px"
id=
"y_up"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_yup(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textYUp"
value=
"1"
>
<br/>
<label>
up vector (z-axis) :
</label>
<input
style=
"width:400px"
id=
"z_up"
type=
"range"
min=
"-100"
max=
"100"
value=
"0"
oninput=
"fn_update_zup(this.value);"
></input>
<input
style=
"width:60px"
type=
"text"
id=
"textZUp"
value=
"0"
>
<br/><hr>
</table>
<br/><br/>
...
...
This diff is collapsed.
Click to expand it.
script.js
+
77
−
2
View file @
ee6fe81b
...
...
@@ -176,7 +176,17 @@ var xMove = 0.0;
var
yMove
=
0.0
;
var
zMove
=
0.0
;
var
rotate_axis
=
0.0
;
var
xEye
=
0.0
;
var
yEye
=
0.0
;
var
zEye
=
2.0
;
var
xCenter
=
0.0
;
var
yCenter
=
0.0
;
var
zCenter
=
0.0
;
var
xUp
=
0.0
;
var
yUp
=
1.0
;
var
zUp
=
0.0
;
/* modify end */
function
fn_speed_scale
(
a
)
...
...
@@ -267,6 +277,71 @@ function fn_update_zmove(val)
zMove
=
val
;
}
function
fn_update_xeye
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textXEye
'
).
value
=
val
;
xEye
=
val
;
}
function
fn_update_yeye
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textYEye
'
).
value
=
val
;
yEye
=
val
;
}
function
fn_update_zeye
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textZEye
'
).
value
=
val
;
zEye
=
val
;
}
function
fn_update_xcenter
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textXCenter
'
).
value
=
val
;
xCenter
=
val
;
}
function
fn_update_ycenter
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textYCenter
'
).
value
=
val
;
yCenter
=
val
;
}
function
fn_update_zcenter
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textZCenter
'
).
value
=
val
;
zCenter
=
val
;
}
function
fn_update_xup
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textXUp
'
).
value
=
val
;
xUp
=
val
;
}
function
fn_update_yup
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textYUp
'
).
value
=
val
;
yUp
=
val
;
}
function
fn_update_zup
(
val
)
{
val
=
val
/
100.0
;
document
.
getElementById
(
'
textZUp
'
).
value
=
val
;
zUp
=
val
;
}
/* modify end */
function
fn_toggle
(
mode
)
...
...
@@ -322,7 +397,7 @@ function renderScene() {
mat4
.
rotateZ
(
mMat
,
mMat
,
zRot
);
mat4
.
perspective
(
pMat
,
fov_degree
*
3.141592
/
180.0
,
8.0
/
6.0
,
0.5
,
6
);
mat4
.
lookAt
(
vMat
,
[
0
,
0
,
2
],
[
0.0
,
0.0
,
0.0
],
[
0
,
1
,
0
]);
mat4
.
lookAt
(
vMat
,
[
xEye
,
yEye
,
zEye
],
[
xCenter
,
yCenter
,
zCenter
],
[
xUp
,
yUp
,
zUp
]);
// mat4.frustum(vMat, -8.0/6.0, 8.0/6.0, 1, 1, 1, );
if
(
flag_animation
==
1
)
...
...
This diff is collapsed.
Click to expand it.
temp.js
deleted
100644 → 0
+
0
−
1373
View file @
a17ea902
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment