Browse Source

Examples: Improved misc_uv_tests.

Mr.doob 5 years ago
parent
commit
b2eaf43e20
2 changed files with 26 additions and 10 deletions
  1. 9 9
      examples/jsm/utils/UVsDebug.js
  2. 17 1
      examples/misc_uv_tests.html

+ 9 - 9
examples/jsm/utils/UVsDebug.js

@@ -37,13 +37,13 @@ var UVsDebug = function ( geometry, size ) {
 	canvas.height = height;
 
 	var ctx = canvas.getContext( '2d' );
-	ctx.lineWidth = 2;
-	ctx.strokeStyle = 'rgba( 0, 0, 0, 1.0 )';
+	ctx.lineWidth = 1;
+	ctx.strokeStyle = 'rgb( 63, 63, 63 )';
 	ctx.textAlign = 'center';
 
 	// paint background white
 
-	ctx.fillStyle = 'rgba( 255, 255, 255, 1.0 )';
+	ctx.fillStyle = 'rgb( 255, 255, 255 )';
 	ctx.fillRect( 0, 0, width, height );
 
 	if ( geometry.isGeometry ) {
@@ -132,11 +132,11 @@ var UVsDebug = function ( geometry, size ) {
 
 			if ( j === 0 ) {
 
-				ctx.moveTo( uv.x * width, ( 1 - uv.y ) * height );
+				ctx.moveTo( uv.x * ( width - 2 ) + 0.5, ( 1 - uv.y ) * ( height - 2 ) + 0.5 );
 
 			} else {
 
-				ctx.lineTo( uv.x * width, ( 1 - uv.y ) * height );
+				ctx.lineTo( uv.x * ( width - 2 ) + 0.5, ( 1 - uv.y ) * ( height - 2 ) + 0.5 );
 
 			}
 
@@ -151,8 +151,8 @@ var UVsDebug = function ( geometry, size ) {
 
 		// label the face number
 
-		ctx.font = '12pt Arial bold';
-		ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )';
+		ctx.font = '18px Arial';
+		ctx.fillStyle = 'rgb( 63, 63, 63 )';
 		ctx.fillText( index, a.x * width, ( 1 - a.y ) * height );
 
 		if ( a.x > 0.95 ) {
@@ -165,8 +165,8 @@ var UVsDebug = function ( geometry, size ) {
 
 		//
 
-		ctx.font = '8pt Arial bold';
-		ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )';
+		ctx.font = '12px Arial';
+		ctx.fillStyle = 'rgb( 191, 191, 191 )';
 
 		// label uv edge orders
 

+ 17 - 1
examples/misc_uv_tests.html

@@ -4,6 +4,22 @@
 		<title>three.js - uv mapping tests</title>
 		<meta charset=utf-8 />
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				background: #ffffff;
+				color: #000000;
+				text-align: center;
+				font-family: sans-serif;
+			}
+			h3 {
+				margin-top: 60px;
+				margin-bottom: 30px;
+				font-weight: normal;
+			}
+			canvas {
+				width: 100%;
+			}
+		</style>
 	</head>
 
 	<body>
@@ -23,7 +39,7 @@
 
 				var d = document.createElement( 'div' );
 
-				d.innerHTML = '<br><br>' + name + '<br>';
+				d.innerHTML = '<h3>' + name + '</h3>';
 
 				d.appendChild( UVsDebug( geometry ) );