<commit_before><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - modifier - tessellation</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="main.css">
	</head>

	<body>
		<div id="info"><a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - modifier tessellation</div>
		<div id="container"></div>

		<script type="x-shader/x-vertex" id="vertexshader">

			uniform float amplitude;

			attribute vec3 customColor;
			attribute vec3 displacement;

			varying vec3 vNormal;
			varying vec3 vColor;

			void main() {

				vNormal = normal;
				vColor = customColor;

				vec3 newPosition = position + normal * amplitude * displacement;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );

			}

		</script>

		<script type="x-shader/x-fragment" id="fragmentshader">

			varying vec3 vNormal;
			varying vec3 vColor;

			void main() {

				const float ambient = 0.4;

				vec3 light = vec3( 1.0 );
				light = normalize( light );

				float directional = max( dot( vNormal, light ), 0.0 );

				gl_FragColor = vec4( ( directional + ambient ) * vColor, 1.0 );

			}

		</script>

		<script type="module">

			import * as THREE from '../build/three.module.js';

			import Stats from './jsm/libs/stats.module.js';

			import { TrackballControls } from './jsm/controls/TrackballControls.js';
			import { TessellateModifier } from './jsm/modifiers/TessellateModifier.js';

			let renderer, scene, camera, stats;

			let controls;

			let mesh, uniforms;

			const WIDTH = window.innerWidth;
			const HEIGHT = window.innerHeight;

			const loader = new THREE.FontLoader();
			loader.load( 'fonts/helvetiker_bold.typeface.json', function ( font ) {

				init( font );
				animate();

			} );

			function init( font ) {

				camera = new THREE.PerspectiveCamera( 40, WIDTH / HEIGHT, 1, 10000 );
				camera.position.set( - 100, 100, 200 );

				scene = new THREE.Scene();
				scene.background = new THREE.Color( 0x050505 );

				//

				let geometry = new THREE.TextGeometry( "THREE.JS", {

					font: font,

					size: 40,
					height: 5,
					curveSegments: 3,

					bevelThickness: 2,
					bevelSize: 1,
					bevelEnabled: true

				} );

				geometry.center();

				const tessellateModifier = new TessellateModifier( 8, 6 );

				geometry = tessellateModifier.modify( geometry );

				//

				geometry = new THREE.BufferGeometry().fromGeometry( geometry );

				const numFaces = geometry.attributes.position.count / 3;

				const colors = new Float32Array( numFaces * 3 * 3 );
				const displacement = new Float32Array( numFaces * 3 * 3 );

				const color = new THREE.Color();<commit_msg>Examples: More clean up.<commit_after><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - modifier - tessellation</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="main.css">
	</head>

	<body>
		<div id="info"><a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - modifier tessellation</div>
		<div id="container"></div>

		<script type="x-shader/x-vertex" id="vertexshader">

			uniform float amplitude;

			attribute vec3 customColor;
			attribute vec3 displacement;

			varying vec3 vNormal;
			varying vec3 vColor;

			void main() {

				vNormal = normal;
				vColor = customColor;

				vec3 newPosition = position + normal * amplitude * displacement;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );

			}

		</script>

		<script type="x-shader/x-fragment" id="fragmentshader">

			varying vec3 vNormal;
			varying vec3 vColor;

			void main() {

				const float ambient = 0.4;

				vec3 light = vec3( 1.0 );
				light = normalize( light );

				float directional = max( dot( vNormal, light ), 0.0 );

				gl_FragColor = vec4( ( directional + ambient ) * vColor, 1.0 );

			}

		</script>

		<script type="module">

			import * as THREE from '../build/three.module.js';

			import Stats from './jsm/libs/stats.module.js';

			import { TrackballControls } from './jsm/controls/TrackballControls.js';
			import { TessellateModifier } from './jsm/modifiers/TessellateModifier.js';

			let renderer, scene, camera, stats;

			let controls;

			let mesh, uniforms;

			const WIDTH = window.innerWidth;
			const HEIGHT = window.innerHeight;

			const loader = new THREE.FontLoader();
			loader.load( 'fonts/helvetiker_bold.typeface.json', function ( font ) {

				init( font );
				animate();

			} );

			function init( font ) {

				camera = new THREE.PerspectiveCamera( 40, WIDTH / HEIGHT, 1, 10000 );
				camera.position.set( - 100, 100, 200 );

				scene = new THREE.Scene();
				scene.background = new THREE.Color( 0x050505 );

				//

				let geometry = new THREE.TextBufferGeometry( 'THREE.JS', {

					font: font,

					size: 40,
					height: 5,
					curveSegments: 3,

					bevelThickness: 2,
					bevelSize: 1,
					bevelEnabled: true

				} );

				geometry.center();

				const tessellateModifier = new TessellateModifier( 8, 6 );

				geometry = tessellateModifier.modify( geometry );

				//

				const numFaces = geometry.attributes.position.count / 3;

				const colors = new Float32Array( numFaces * 3 * 3 );
				const displacement = new Float32Array( numFaces * 3 * 3 );

				const color = new THREE.Color();
{'fraction_non_alphanumeric': 0.13618254255704454, 'fraction_numerical': 0.02426657008330315, 'mean_word_length': 3.091111111111111, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '400112', 'n_tokens_mistral': 2325, 'n_tokens_neox': 1746, 'n_words': 454}