How change the bevel size of 3d text in x3dom? Now i have code like this
<x3d width="392px" height="392px">
<scene>
<viewpoint position='0 0 11'></viewpoint>
<background skyColor='0.5 0.5 0.5'></background>
<shape>
<appearance>
<material ambientIntensity='0.0933' diffuseColor='0.32 0.54 0.26' shininess='0.51' specularColor='0.46 0.46 0.46'></material>
</appearance>
<text string='Mono bolditalic 32px' solid='false'>
<fontstyle family="TYPEWRITER" style="BOLDITALIC" size="0.8"></fontstyle>
</text>
</shape>
<transform translation='0 0 -2'>
<shape>
<appearance>
<material diffuseColor="1 0 0" specularColor="0.5 0.5 0.5"></material>
</appearance>
<box></box>
</shape>
</transform>
</scene>
</x3d>
Is there any sample code available for this?
It looks like there aren't any outright examples of beveling text with X3Dom alone. three.js seems to be the only webgl solution, I see, where you can easily change the bevel of 3D text. You seem to have found this based on your latest questions.
Here are some other good resources/examples for three.js.
Also, here are some JSFiddle examples. These will be much easier to read/experiement with.
I was having issues getting a JSFiddle setup. A fellow programmer was having a similar issue but with his help I setup a useful example. This will allow you a chance to experiment with the bevel capability.
Bevel Example: http://jsfiddle.net/VsWb9/674/
JavaScript
// This is where stuff in our game will happen:
var scene = new THREE.Scene();
// This is what sees the stuff:
var aspect_ratio = window.innerWidth / window.innerHeight;
var camera = new THREE.PerspectiveCamera(45, aspect_ratio, 1, 100000);
camera.position.z = 800;
camera.position.x = 350;
scene.add(camera);
// This will draw what the camera sees onto the screen:
var renderer = new THREE.WebGLRenderer();
// var renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// ******** START CODING ON THE NEXT LINE ********
var shape = new THREE.TextGeometry("Game Over",
{font: 'helvetiker',
bevelThickness: '3',
bevelSize: '3',
bevelSegments: '4',
bevelEnabled: 'true'});
var wrapper = new THREE.MeshNormalMaterial({color: 0x00ff00});
var words = new THREE.Mesh(shape, wrapper);
scene.add(words);
// Now, show what the camera sees on the screen:
renderer.render(scene, camera);
Additional JS
<script src="http://gamingJS.com/Three.js"></script>
<script src="http://gamingJS.com/ChromeFixes.js"></script>
<script src="http://mrdoob.github.com/three.js/examples/fonts/helvetiker_regular.typeface.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With