Skip to content

Commit

Permalink
PlySurface and a Few Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetcecen committed May 3, 2016
1 parent 5aa0c11 commit 61e5c29
Show file tree
Hide file tree
Showing 10 changed files with 307,905 additions and 129 deletions.
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

title: Project Pages
header-img: img/home-bg.jpg
logo: /project-pages/img/logos/Project-Pages-New-Logo-Inverted.png
email: [email protected]
description: "Write your site description here. It will be used as your sites meta description as well!"
baseurl: "/project-pages"
Expand All @@ -10,7 +11,7 @@ github_username: matin-hub
project_repository: project-pages
disqus_shortname: project-pages
g-analytics: UA-75881392-1

# Build settings
# Don't change these variables
gems: [jekyll-paginate]
Expand Down
4 changes: 3 additions & 1 deletion _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="site-heading" style="padding: 75px 0">
{% if page.url == '/' %}
<img src= "/project-pages/img/logos/Project-Pages-New-Logo-Inverted.png" style="height: 150px">
{% if site.logo %}
<img src= "{{ site.logo }}" style="height: 150px">
{% endif %}
{% else %}{% endif %}
<h1>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</h1>
<hr class="small">
Expand Down
176 changes: 176 additions & 0 deletions _layouts/plysurface.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@

<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ page.title }}</title>
<meta charset="utf-8">
<style>
body {
margin: 0px;
background-color: #ffffff;
color: #000000;
font-family:Monospace;
text-align: center;
font-size: 15px;
line-height: 30px;
overflow: hidden;
}
#info {
position: absolute;
top: 0px; width: 100%;
padding: 15px;
z-index:100;
}
</style>
</head>
<body>

<div id="info">
"W" translate | "E" rotate | "R" scale | "+" increase size | "-" decrease size<br />
Press "Q" to toggle world/local space, keep "Ctrl" down to snap to grid
</div>



<script src="{{"/js/plythreejs/three.min.js " | prepend: site.baseurl}}"></script>
<script src="{{"/js/plythreejs/TransformControls.js " | prepend: site.baseurl}}"></script>
<script src="{{"/js/plythreejs/PLYLoader.js " | prepend: site.baseurl}}"></script>

<script>

var camera, scene, renderer, control;

var mesh

var loader = new THREE.PLYLoader();
loader.load( '{{ page.plydata | prepend: site.baseurl }}', function ( geometry ) {

geometry.computeBoundingBox()
geometry.translate(-((geometry.boundingBox.max.x - geometry.boundingBox.min.x)/2 + geometry.boundingBox.min.x) , -((geometry.boundingBox.max.y - geometry.boundingBox.min.y)/2 + geometry.boundingBox.min.y) , -((geometry.boundingBox.max.z - geometry.boundingBox.min.z)/2 + geometry.boundingBox.min.z));

var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 200, vertexColors: THREE.VertexColors} );
mesh = new THREE.Mesh( geometry, material );

mesh.position.set( 0, 250, 0 );
mesh.rotation.set( 0, - Math.PI / 2, 0 );
mesh.scale.set( 10, 10, 10 );



mesh.castShadow = true;
mesh.receiveShadow = true;

init();
render();

} );

function init() {

renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.sortObjects = false;
document.body.appendChild( renderer.domElement );
renderer.setClearColor( 0xffffff );


//

camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
camera.position.set( 1000, 500, 1000 );
camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );

scene = new THREE.Scene();

var light = new THREE.AmbientLight( 0xFFFFFF );
light.position.set( 1, 1, 1 );
scene.add( light );

control = new THREE.TransformControls( camera, renderer.domElement );
control.addEventListener( 'change', render );

scene.add( mesh );

control.attach( mesh );
scene.add( control );

window.addEventListener( 'resize', onWindowResize, false );

window.addEventListener( 'keydown', function ( event ) {

switch ( event.keyCode ) {

case 81: // Q
control.setSpace( control.space === "local" ? "world" : "local" );
break;

case 17: // Ctrl
control.setTranslationSnap( 100 );
control.setRotationSnap( THREE.Math.degToRad( 15 ) );
break;

case 87: // W
control.setMode( "translate" );
break;

case 69: // E
control.setMode( "rotate" );
break;

case 82: // R
control.setMode( "scale" );
break;

case 187:
case 107: // +, =, num+
control.setSize( control.size + 0.1 );
break;

case 189:
case 109: // -, _, num-
control.setSize( Math.max( control.size - 0.1, 0.1 ) );
break;

}

});

window.addEventListener( 'keyup', function ( event ) {

switch ( event.keyCode ) {

case 17: // Ctrl
control.setTranslationSnap( null );
control.setRotationSnap( null );
break;

}

});

}

function onWindowResize() {

camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

renderer.setSize( window.innerWidth, window.innerHeight );

render();

}

function render() {

control.update();

renderer.render( scene, camera );

}

</script>

</body>
</html>
118 changes: 0 additions & 118 deletions _posts/2015-01-01-New-Post-2.markdown

This file was deleted.

11 changes: 11 additions & 0 deletions _posts/2016-05-02-New-Surface-Visualization.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: plysurface
title: New Surface Visualization
date: 2016-05-02
author: Ahmet Cecen
tags: plysurface visualization template
subtitle: Some Short Description of the Visualization

plydata: /ply/ChunkColoredWeb.ply
---

18 changes: 9 additions & 9 deletions css/clean-blog.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.intro-header .site-heading,
.intro-header .post-heading,
.intro-header .page-heading {
padding: 100px 0 50px;
color: #FFFFFF;
}
body {
font-family: 'Lora', 'Times New Roman', serif;
font-size: 20px;
Expand Down Expand Up @@ -42,7 +48,7 @@ hr.small {
max-width: 100px;
margin: 15px auto;
border-width: 4px;
border-color: white;
border-color: #FFFFFF;
}
.navbar-custom {
background: white;
Expand Down Expand Up @@ -141,12 +147,6 @@ hr.small {
-o-background-size: cover;
margin-bottom: 20px;
}
.intro-header .site-heading,
.intro-header .post-heading,
.intro-header .page-heading {
padding: 100px 0 50px;
color: white;
}
@media only screen and (min-width: 768px) {
.intro-header .site-heading,
.intro-header .post-heading,
Expand All @@ -166,8 +166,8 @@ hr.small {
.intro-header .site-heading .subheading,
.intro-header .page-heading .subheading {
font-size: 24px;
line-height: 1.1,
display: block;
line-height: 1.1;
display: block;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 300;
margin: 10px 0 0;
Expand Down
Loading

0 comments on commit 61e5c29

Please sign in to comment.