Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CG 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
김형모
CG Tutorial
Commits
9c415d51
Commit
9c415d51
authored
2 years ago
by
김형모
Browse files
Options
Downloads
Patches
Plain Diff
Delete pointlightshadow2.js
parent
6888ea48
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pointlightshadow2.js
+0
-74
0 additions, 74 deletions
pointlightshadow2.js
with
0 additions
and
74 deletions
pointlightshadow2.js
deleted
100644 → 0
+
0
−
74
View file @
6888ea48
const
function0
=
function
(){
const
h_scr2
=
window
.
innerWidth
;
const
v_scr2
=
window
.
innerHeight
;
const
scene2
=
new
THREE
.
Scene
();
const
camera2
=
new
THREE
.
PerspectiveCamera
(
120
,
h_scr2
/
v_scr2
,
0.1
,
1000
);
camera2
.
position
.
y
=
15
;
camera2
.
lookAt
(
0
,
0
,
0
);
//Create a WebGLRenderer and turn on shadows in the renderer
const
renderer2
=
new
THREE
.
WebGLRenderer
({
canvas
:
HelloCanvas
});
renderer2
.
setSize
(
h_scr2
,
v_scr2
);
renderer2
.
shadowMap
.
enabled
=
true
;
const
light2
=
new
THREE
.
PointLight
(
0xffffff
,
1
,
100
);
//const light2 = new THREE.DirectionalLight( 0xffffff, 1);
//light2.position.set( 0, 0, 1 );
//directioanl은 항상 위에서 온다.
//light2.rotaion.x = 90;
light2
.
castShadow
=
true
;
// default false
//light2.autoUpdate = false;
scene2
.
add
(
light2
);
//Set up shadow properties for the light
//light2.shadow.mapSize.width = 128; // default
//light2.shadow.mapSize.height = 128; // default
//light2.shadow.camera.near = 0.5; // default
//light2.shadow.camera.far = 500; // default
//Create a sphere that cast shadows (but does not receive them)
const
sphereGeometry
=
new
THREE
.
SphereGeometry
(
5
,
32
,
32
);
const
sphereMaterial
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffff00
,
shininess
:
90.0
});
const
sphere
=
new
THREE
.
Mesh
(
sphereGeometry
,
sphereMaterial
);
sphere
.
castShadow
=
true
;
//default is false
sphere
.
receiveShadow
=
false
;
//default
scene2
.
add
(
sphere
);
//Create a plane that receives shadows (but does not cast them)
const
planeGeometry
=
new
THREE
.
PlaneGeometry
(
60
,
60
,
32
,
32
);
const
planeMaterial
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0xffffff
}
)
const
plane
=
new
THREE
.
Mesh
(
planeGeometry
,
planeMaterial
);
plane
.
receiveShadow
=
true
;
plane
.
rotation
.
x
=
-
1.57
;
plane
.
position
.
set
(
0
,
-
5
,
0
);
scene2
.
add
(
plane
);
//Create a helper for the shadow camera (optional)
const
helper
=
new
THREE
.
CameraHelper
(
light2
.
shadow
.
camera
);
scene2
.
add
(
helper
);
var
x
=
-
12
;
var
x_trans
=
0
;
const
animate
=
function
()
{
requestAnimationFrame
(
animate
);
if
(
x
>=
12
)
{
x_trans
=
-
0.1
;
}
else
if
(
x
<=-
12
)
{
x_trans
=
+
0.1
;
}
x
+=
x_trans
;
light2
.
position
.
set
(
x
,
10
,
0
);
renderer2
.
render
(
scene2
,
camera2
);
};
animate
();
}
function0
();
\ No newline at end of file
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