<commit_before>/**
 * @author AnastasiaVictor/ http://github.com/avmakesthings
 * @author JohnFaichney/ http://github.com/johnvf
 * 
 * A-frame Renderers
 */

//updates the material of a gltf model
//optionally creates wireframe edges
AFRAME.registerComponent('gltf-renderer', {
	schema: {},
	init: function () {
		var el = this.el;
		var myScene = document.querySelector('a-scene');
		var phongMaterial = new THREE.MeshPhongMaterial( {  
			color: 0x4286F4,
			specular: 0xffffff, 
			shininess: 50, 
			transparent: true,
			opacity: 0.5,
			polygonOffset: true,
			polygonOffsetFactor: 1, // positive value pushes polygon further away
			polygonOffsetUnits: 1
		} );
		var lineMat = new THREE.LineBasicMaterial( { 
			color: 0x000000, linewidth: 10 
		} );
		var wireframeEl = document.createElement('a-entity')
		wireframeEl.setAttribute('id', 'wireframe-el')

		//changed the event bc model-loaded was called for every model
		//object3dset is emitted once when all models have loaded
		el.addEventListener('object3dset',(e)=>{
			var modelGeo = el.object3D
			if(!modelGeo){
				return
			}
			modelGeo.traverse(function(item){
				item.material = phongMaterial;
				//this is supposed to add wireframe geo
				//to each child object3D 
				var geo = new THREE.WireframeGeometry( item );
				var wireframe = new THREE.LineSegments( geo, lineMat );
				wireframeEl.object3D.add(wireframe)
			});
		})
		el.appendChild(wireframeEl)
  }
});


//Update environment settings - refined shadows
AFRAME.registerComponent('update-sun', {
schema: {},
update: function (){
	env = document.querySelector('a-entity[environment]');
	mySun = env.components.environment.sunlight.components.light;
	mySun.light.shadow.mapSize.x = 4000;
	mySun.light.shadow.mapSize.y = 4000;<commit_msg>working mesh wireframe stuff<commit_after>/**
 * @author AnastasiaVictor/ http://github.com/avmakesthings
 * @author JohnFaichney/ http://github.com/johnvf
 * 
 * A-frame Renderers
 */

//updates the material of a gltf model
//optionally creates wireframe edges
AFRAME.registerComponent('gltf-renderer', {
	schema: {},
	init: function () {
		var el = this.el;
		var myScene = document.querySelector('a-scene');
		var phongMaterial = new THREE.MeshPhongMaterial( {  
			color: 0x4286F4,
			specular: 0xffffff, 
			shininess: 50, 
			transparent: true,
			opacity: 0.5,
			polygonOffset: true,
			polygonOffsetFactor: 1, // positive value pushes polygon further away
			polygonOffsetUnits: 1
		} );
		var lineMat = new THREE.LineBasicMaterial( { 
			color: 0x000000, linewidth: 2 
		} );
		var wireframeEl = document.createElement('a-entity')
		wireframeEl.setAttribute('id', 'wireframe-el')

		//changed the event bc model-loaded was called for every model
		//object3dset is emitted once when all models have loaded
		el.addEventListener('object3dset',(e)=>{
			var modelGeo = el.object3D
			if(!modelGeo){
				return
			}

			var wireframes = []

			modelGeo.traverse(function(item){
				if (item.geometry){
					item.material = phongMaterial;
					var geo = new THREE.EdgesGeometry( item.geometry );
					var wireframe = new THREE.LineSegments( geo, lineMat );
					// We can't modify the children *during* 'traverse' or we'll recurse infinitely.
					// Queue these up and add them later
					wireframes.push({
						wireframe,
						item
					})
				}
			});

			wireframes.forEach(({wireframe, item})=>{
				item.add(wireframe)
			})

		})
		el.appendChild(wireframeEl)
  }
});


//Update environment settings - refined shadows
AFRAME.registerComponent('update-sun', {
schema: {},
update: function (){
	env = document.querySelector('a-entity[environment]');
	mySun = env.components.environment.sunlight.components.light;
	mySun.light.shadow.mapSize.x = 4000;
	mySun.light.shadow.mapSize.y = 4000;
{'fraction_non_alphanumeric': 0.12317880794701987, 'fraction_numerical': 0.017748344370860928, 'mean_word_length': 3.6502463054187193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '1303394', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1206, 'n_words': 294}