Skip to content

Commit

Permalink
feat: no antilaising on mobil devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Rabbid76 authored Dec 25, 2023
1 parent 6df22b3 commit ddb5fd8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion deploy/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deploy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
position: absolute;
bottom: 20px;
left: 100px;
font-family: sans-serif;
}
.label {
color: #000000;
Expand All @@ -58,7 +59,6 @@
.exr<br />.hdr<br />.envmap<br /><br />.glb<br />.gltf
</div>
<button id="save-button" type="button">save</button>
<canvas id="three_canvas"> </canvas>
</div>
<script type="module" src="bundle.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion dist/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
position: absolute;
bottom: 20px;
left: 100px;
font-family: sans-serif;
}
.label {
color: #000000;
Expand All @@ -58,7 +59,6 @@
.exr<br />.hdr<br />.envmap<br /><br />.glb<br />.gltf
</div>
<button id="save-button" type="button">save</button>
<canvas id="three_canvas"> </canvas>
</div>
<script type="module" src="bundle.js"></script>
</body>
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
"update:modules": "ncu -u && npm update && npm i",
"build:client": "webpack --config ./src/client/webpack.prod.js",
"build:server": "tsc -p ./src/server",
"build": "npm run build:client && npm run build:server",
"build": "npm run copy:assets && npm run build:client && npm run build:server",
"dev": "webpack serve --config ./src/client/webpack.dev.js",
"start": "node ./dist/server/three_server.js",
"copy:assets": "copyfiles --flat ./deploy/*.glb ./dist/client",
"copy:deploy": "copyfiles --flat ./dist/client/*.js ./deploy && copyfiles --flat ./dist/client/*.png ./deploy && copyfiles --flat ./dist/client/*.envmap ./deploy",
"postinstall": "patch-package",
"patch:create": "npx patch-package realism-effects"
Expand All @@ -23,7 +24,7 @@
"@types/dat.gui": "^0.7.12",
"@types/express": "^4.17.21",
"@types/node": "^20.10.5",
"@types/three": "^0.159.0",
"@types/three": "^0.160.0",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"axios": "^1.6.2",
Expand All @@ -33,7 +34,7 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "27.6.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.1.1",
"eslint-plugin-prettier": "5.1.2",
"install-peers": "^1.0.4",
"npm-check-updates": "^16.14.12",
"patch-package": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/client/renderer/materials/illumination-buffer-material.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Box3, Shader, WebGLRenderer } from 'three';
import type { Box3, WebGLRenderer } from 'three';
import { MeshLambertMaterial, Vector2, Vector3, Vector4 } from 'three';

interface ThreeShader {
Expand Down Expand Up @@ -42,7 +42,7 @@ export class IlluminationBufferMaterial extends MeshLambertMaterial {
IlluminationBufferMaterial._sceneBoxMax.copy(box.max);
}

private _onBeforeCompile(materialShader: Shader, _renderer: WebGLRenderer) {
private _onBeforeCompile(materialShader: any, _renderer: WebGLRenderer) {
materialShader.vertexShader = screenSpaceShadowMaterialVertexShader;
materialShader.fragmentShader = screenSpaceShadowMaterialFragmentShader;
(materialShader as ThreeShader).defines = Object.assign({
Expand Down
12 changes: 4 additions & 8 deletions src/client/threeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,22 @@ const setGroundMaterial = () => {
};

const fixedResolution: any = undefined;
const threeCanvas = document.getElementById('three_canvas');
const container = document.getElementById('container') as HTMLDivElement;
const renderer = new WebGLRenderer({
// @ts-ignore
canvas: threeCanvas,
antialias: true,
antialias: !isMobile,
alpha: true,
preserveDrawingBuffer: true,
});
renderer.setPixelRatio(window.devicePixelRatio);
//renderer.physicallyCorrectLights = true
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
container.appendChild(renderer.domElement);
const labelRenderer = new CSS2DRenderer();
labelRenderer.setSize(window.innerWidth, window.innerHeight);
labelRenderer.domElement.style.position = 'absolute';
labelRenderer.domElement.style.top = '0px';
labelRenderer.domElement.style.pointerEvents = 'none';
document.body.appendChild(labelRenderer.domElement);
container.appendChild(labelRenderer.domElement);

// @ts-ignore
const stats = new Stats();
document.body.appendChild(stats.dom);

Expand Down

0 comments on commit ddb5fd8

Please sign in to comment.