-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
executable file
·120 lines (114 loc) · 4.46 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<title>Software Renderer</title>
<style>
* {
margin: 0;
padding: 0;
}
canvas {
margin-left: 5%;
margin-top: 3%;
width: 90%;
height: 90%;
}
button {
width: 100%;
height: 30px;
margin: 10px;
}
.left {
height: 100vh;
width: 200px;
float: left;
}
.right {
margin-left: 200px;
height: 100vh;
}
</style>
<script src="js/math/color.js"></script>
<script src="js/math/matrix.js"></script>
<script src="js/math/vector.js"></script>
<script src="js/device.js"></script>
<script src="js/camera.js"></script>
<script src="js/model.js"></script>
<script src="js/texture.js"></script>
<script src="js/light.js"></script>
<script src="js/shader.js"></script>
<script src="js/raster.js"></script>
<script src="main.js"></script>
</head>
<body>
<div class="left">
<div style="margin-top: 15%; margin-left: 10%">
<div>
<button onclick="StartConfigRender()">开始渲染</button>
</div>
<div style="color: magenta">
<label>FPS : </label>
<label id="fpsDisplay">0</label>
</div>
<div style="display: none;">
<label>模型文件:</label>
<input id="modelFile" type="file" onchange="StartConfigRender()" style="width: 50%" multiple>
</div>
<div>
<label>线框模式:</label>
<input id="wireFrameMode" type="checkbox" onchange="UpdateWireFrameMode()">
</div>
<div>
<label>深度测试:</label>
<input id="depthTestMode" type="checkbox" onchange="UpdateDepthTestMode()">
</div>
<div>
<label>背面剔除:</label>
<div style="margin-left: 20px">
<label>CCW : </label>
<input id="ccwCullMode" type="checkbox" onchange="UpdateCCWCullMode()">
<label>CW : </label>
<input id="cwCullMode" type="checkbox" onchange="UpdateCWCullMode()">
</div>
</div>
<div>
<label>摄像机:</label>
<div style="margin-left: 20px">
<label>位置:</label>
<input id="cameraLocationX" type="text" onchange="UpdateCameraLocation()" style="width: 10%">
<input id="cameraLocationY" type="text" onchange="UpdateCameraLocation()" style="width: 10%">
<input id="cameraLocationZ" type="text" onchange="UpdateCameraLocation()" style="width: 10%">
</div>
<div style="margin-left: 20px">
<label>目标:</label>
<input id="cameraLookAtX" type="text" onchange="UpdateCameraLookAt()" style="width: 10%">
<input id="cameraLookAtY" type="text" onchange="UpdateCameraLookAt()" style="width: 10%">
<input id="cameraLookAtZ" type="text" onchange="UpdateCameraLookAt()" style="width: 10%">
</div>
</div>
<div>
<label>光照:</label>
<div style="margin-left: 20px">
<label>平向光 : </label>
<input id="directionLight" type="checkbox" onchange="UpdateLightMode()">
<input id="lightDirectionX" type="text" onchange="UpdateLightDirection()"
style="margin-left: 5px ; width: 10%">
<input id="lightDirectionY" type="text" onchange="UpdateLightDirection()" style="width: 10%">
<input id="lightDirectionZ" type="text" onchange="UpdateLightDirection()" style="width: 10%">
</div>
<div style="margin-left: 20px">
<label>点光源 : </label>
<input id="pointLight" type="checkbox" onchange="UpdateLightMode()">
<input id="lightPositionX" type="text" onchange="UpdateLightPosition()"
style="margin-left: 5px ;width: 10%">
<input id="lightPositionY" type="text" onchange="UpdateLightPosition()" style="width: 10%">
<input id="lightPositionZ" type="text" onchange="UpdateLightPosition()" style="width: 10%">
</div>
</div>
</div>
</div>
<div class="right" id="canvasBox">
<canvas id="frontBuffer" style="background-color: black" width="1200" height="900"></canvas>
</div>
</body>
</html>