X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapes%2FFloorShape.java;fp=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapes%2FFloorShape.java;h=0000000000000000000000000000000000000000;hb=6b6fcff5d6c326feef07ccf8401f97911778fffe;hp=7492a98c1c2175a4c0b4b3c8ba3276576f677f62;hpb=504c111db40d78f4913badddd126b283b5504dbb;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java b/org.simantics.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java deleted file mode 100644 index 7492a98c..00000000 --- a/org.simantics.g3d/src/org/simantics/proconf/g3d/shapes/FloorShape.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007- VTT Technical Research Centre of Finland. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.proconf.g3d.shapes; - -import java.net.URL; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; - -import com.jme.image.Texture; -import com.jme.renderer.ColorRGBA; -import com.jme.renderer.Renderer; -import com.jme.scene.Geometry; -import com.jme.scene.TriMesh; -import com.jme.scene.state.MaterialState; -import com.jme.scene.state.TextureState; -import com.jme.util.TextureManager; -import com.jme.util.geom.BufferUtils; - -public class FloorShape { - - private static String textureLocation = "src/jmetest/data/texture/Detail.jpg"; - - public static Geometry getShape(Renderer renderer, float size, float texScale) { - - float coords[] = new float[3 * 4]; - float normals[] = new float[3 * 4]; - float texcoords[] = new float[2 * 4]; - int indices[] = new int[] { 0, 2, 1, 1, 2, 3 }; - coords[0] = -size; - coords[1] = 0.f; - coords[2] = -size; - coords[3] = size; - coords[4] = 0.f; - coords[5] = -size; - coords[6] = -size; - coords[7] = 0.f; - coords[8] = size; - coords[9] = size; - coords[10] = 0.f; - coords[11] = size; - texcoords[0] = -size*texScale; - texcoords[1] = -size*texScale; - texcoords[2] = size*texScale; - texcoords[3] = -size*texScale; - texcoords[4] = -size*texScale; - texcoords[5] = size*texScale; - texcoords[6] = size*texScale; - texcoords[7] = size*texScale; - normals[0] = 0.f; - normals[1] = 1.f; - normals[2] = 0.f; - normals[3] = 0.f; - normals[4] = 1.f; - normals[5] = 0.f; - normals[6] = 0.f; - normals[7] = 1.0f; - normals[8] = 0.f; - normals[9] = 0.f; - normals[10] = 1.f; - normals[11] = 0.f; - - TriMesh shape = new TriMesh("",BufferUtils.createFloatBuffer(coords),BufferUtils.createFloatBuffer(normals),null,BufferUtils.createFloatBuffer(texcoords),BufferUtils.createIntBuffer(indices)); - MaterialState ms = renderer.createMaterialState(); - ms.setEmissive(new ColorRGBA(0.5f,0.5f,0.5f,0.f)); - ms.setDiffuse(new ColorRGBA(1.f,1.f,1.f,0.f)); - ms.setShininess(128.f); - shape.setRenderState(ms); - shape.setCullMode(Geometry.CULL_NEVER); - - TextureState ts = renderer.createTextureState(); - URL url = FileLocator.find(com.jme.eclipse.Activator.getDefault().getBundle(),new Path(textureLocation),null); - Texture tex = TextureManager.loadTexture(url, Texture.MM_LINEAR_LINEAR, - Texture.FM_LINEAR); - tex.setWrap(Texture.WM_WRAP_S_WRAP_T); - ts.setTexture(tex); - shape.setRenderState(ts); - shape.lockShadows(); - return shape; - - } - -}