diff --git a/Android/G3MAndroidSDK/src/org/glob3/mobile/specific/NativeGL2_Android.java b/Android/G3MAndroidSDK/src/org/glob3/mobile/specific/NativeGL2_Android.java index b88170676b..dd1b02693c 100644 --- a/Android/G3MAndroidSDK/src/org/glob3/mobile/specific/NativeGL2_Android.java +++ b/Android/G3MAndroidSDK/src/org/glob3/mobile/specific/NativeGL2_Android.java @@ -521,6 +521,11 @@ public int TextureParameterValue_ClampToEdge() { return GLES20.GL_CLAMP_TO_EDGE; } + @Override + public int TextureParameterValue_Repeat() { + return GLES20.GL_REPEAT; + } + @Override public int Alignment_Pack() { diff --git a/Android/G3MAndroidTestingApplication/src/com/glob3/mobile/g3mandroidtestingapplication/PointCloudActivity.java b/Android/G3MAndroidTestingApplication/src/com/glob3/mobile/g3mandroidtestingapplication/PointCloudActivity.java index 0c4b7984fd..6e780df4b5 100644 --- a/Android/G3MAndroidTestingApplication/src/com/glob3/mobile/g3mandroidtestingapplication/PointCloudActivity.java +++ b/Android/G3MAndroidTestingApplication/src/com/glob3/mobile/g3mandroidtestingapplication/PointCloudActivity.java @@ -7,6 +7,7 @@ import org.glob3.mobile.generated.Color; import org.glob3.mobile.generated.DirectMesh; import org.glob3.mobile.generated.ElevationDataProvider; +import org.glob3.mobile.generated.EllipsoidalPlanet; import org.glob3.mobile.generated.FloatBufferBuilderFromColor; import org.glob3.mobile.generated.FloatBufferBuilderFromGeodetic; import org.glob3.mobile.generated.G3MContext; @@ -26,7 +27,6 @@ import org.glob3.mobile.generated.LayerSet; import org.glob3.mobile.generated.MapBoxLayer; import org.glob3.mobile.generated.MeshRenderer; -import org.glob3.mobile.generated.Planet; import org.glob3.mobile.generated.Quality; import org.glob3.mobile.generated.Sector; import org.glob3.mobile.generated.SingleBilElevationDataProvider; @@ -42,12 +42,12 @@ public class PointCloudActivity - extends - Activity { +extends +Activity { private final class PointsCloudParser - extends - GAsyncTask { + extends + GAsyncTask { private final IByteBuffer _buffer; private DirectMesh _mesh; @@ -121,8 +121,8 @@ public void onPostExecute(final G3MContext context) { } private final class PointsCloudDownloader - extends - IBufferDownloadListener { + extends + IBufferDownloadListener { private final IThreadUtils _threadUtils; @@ -185,7 +185,7 @@ protected void onCreate(final Bundle savedInstanceState) { UPPER LEFT Y=46.3566926359 LOWER RIGHT X=7.1737468920 LOWER RIGHT Y=46.3427207284 - */ + */ // final Geodetic2D lower = new Geodetic2D( // // Angle.fromDegrees(46.3427207284), // @@ -232,7 +232,7 @@ protected void onCreate(final Bundle savedInstanceState) { _builder = new G3MBuilder_Android(this); // _builder.setPlanet(Planet.createSphericalEarth()); - _builder.setPlanet(Planet.createEarth()); + _builder.setPlanet(EllipsoidalPlanet.createEarth()); _builder.getPlanetRendererBuilder().setLayerSet(layerSet); @@ -250,7 +250,7 @@ protected void onCreate(final Bundle savedInstanceState) { _builder.getPlanetRendererBuilder().setElevationDataProvider(dem); _builder.getPlanetRendererBuilder().setQuality(Quality.QUALITY_HIGH); - // + // // final ElevationDataProvider dem = new SingleBillElevationDataProvider(new URL("file:///full-earth-2048x1024.bil", false), // Sector.fullSphere(), new Vector2I(2048, 1024), -1700); // _builder.getPlanetRendererBuilder().setElevationDataProvider(dem); diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/BusyQuadRenderer.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/BusyQuadRenderer.java index e99589dab3..e8a43cbc3e 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/BusyQuadRenderer.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/BusyQuadRenderer.java @@ -37,7 +37,7 @@ private boolean initMesh(G3MRenderContext rc) { TextureIDReference texId = null; - texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), "BusyQuadRenderer-Texture", false); + texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), "BusyQuadRenderer-Texture", false, GLTextureParameterValue.clampToEdge()); if (texId == null) { diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/DTT_TileTextureBuilder.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/DTT_TileTextureBuilder.java index 88fba32437..6e5f0a6d55 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/DTT_TileTextureBuilder.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/DTT_TileTextureBuilder.java @@ -56,7 +56,7 @@ private static LeveledTexturedMesh createMesh(Tile tile, Mesh tessellatorMesh, V if (!fallbackSolved && backgroundTileImage != null) { LazyTextureMapping mapping = new LazyTextureMapping(new DTT_LTMInitializer(tileMeshResolution, tile, tile, tessellator), true, false); - final TextureIDReference glTextureId = texturesHandler.getTextureIDReference(backgroundTileImage, GLFormat.rgba(), backgroundTileImageName, generateMipmap); + final TextureIDReference glTextureId = texturesHandler.getTextureIDReference(backgroundTileImage, GLFormat.rgba(), backgroundTileImageName, generateMipmap, GLTextureParameterValue.clampToEdge()); mapping.setGLTextureId(glTextureId); //Mandatory to active mapping mappings.add(mapping); @@ -143,7 +143,7 @@ public void dispose() public final boolean uploadTexture(IImage image, String imageId) { - final TextureIDReference glTextureId = _texturesHandler.getTextureIDReference(image, GLFormat.rgba(), imageId, _generateMipmap); + final TextureIDReference glTextureId = _texturesHandler.getTextureIDReference(image, GLFormat.rgba(), imageId, _generateMipmap, GLTextureParameterValue.clampToEdge()); if (glTextureId == null) { return false; diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/EllipsoidShape.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/EllipsoidShape.java index c111c6ed95..18d29b95e7 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/EllipsoidShape.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/EllipsoidShape.java @@ -162,7 +162,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc) return null; } - _texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false); + _texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false, GLTextureParameterValue.clampToEdge()); if (_textureImage != null) _textureImage.dispose(); diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GL.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GL.java index be21125183..480c102fdf 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GL.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GL.java @@ -187,7 +187,7 @@ public final int getError() return _nativeGL.getError(); } - public final IGLTextureId uploadTexture(IImage image, int format, boolean generateMipmap) + public final IGLTextureId uploadTexture(IImage image, int format, boolean generateMipmap, int wrapMode) { // if (_verbose) { @@ -218,9 +218,8 @@ public final IGLTextureId uploadTexture(IImage image, int format, boolean genera _nativeGL.texParameteri(texture2D, GLTextureParameter.magFilter(), linear); - final int clampToEdge = GLTextureParameterValue.clampToEdge(); - _nativeGL.texParameteri(texture2D, GLTextureParameter.wrapS(), clampToEdge); - _nativeGL.texParameteri(texture2D, GLTextureParameter.wrapT(), clampToEdge); + _nativeGL.texParameteri(texture2D, GLTextureParameter.wrapS(), wrapMode); + _nativeGL.texParameteri(texture2D, GLTextureParameter.wrapT(), wrapMode); _nativeGL.texImage2D(image, format); diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GLTextureParameterValue.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GLTextureParameterValue.java index 772f85f951..2150e1d95b 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GLTextureParameterValue.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/GLTextureParameterValue.java @@ -9,6 +9,7 @@ public class GLTextureParameterValue private static int _linearMipmapLinear = 0; private static int _clampToEdge = 0; + private static int _repeat = 0; public static int nearest() @@ -40,6 +41,10 @@ public static int clampToEdge() { return _clampToEdge; } + public static int repeat() + { + return _repeat; + } public static void init(INativeGL ngl) { @@ -51,5 +56,6 @@ public static void init(INativeGL ngl) _linearMipmapLinear = ngl.TextureParameterValue_LinearMipmapLinear(); _clampToEdge = ngl.TextureParameterValue_ClampToEdge(); + _repeat = ngl.TextureParameterValue_Repeat(); } } \ No newline at end of file diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDImageRenderer.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDImageRenderer.java index a3c8d22ad8..cb60868474 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDImageRenderer.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDImageRenderer.java @@ -122,7 +122,7 @@ private Mesh createMesh(G3MRenderContext rc) final IStringUtils su = IStringUtils.instance(); final String textureName = "HUDImageRenderer" + su.toString(_instanceID) + "/" + su.toString(_changeCounter++); - final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), textureName, false); + final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), textureName, false, GLTextureParameterValue.clampToEdge()); _image = null; _image = null; diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDQuadWidget.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDQuadWidget.java index 96c999ce9b..0ecebf87a5 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDQuadWidget.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/HUDQuadWidget.java @@ -76,7 +76,7 @@ private Mesh createMesh(G3MRenderContext rc) TexturesHandler texturesHandler = rc.getTexturesHandler(); - final TextureIDReference textureID = texturesHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false); + final TextureIDReference textureID = texturesHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false, GLTextureParameterValue.clampToEdge()); if (textureID == null) { rc.getLogger().logError("Can't upload texture to GPU"); @@ -86,7 +86,7 @@ private Mesh createMesh(G3MRenderContext rc) TextureIDReference backgroundTextureID = null; if (hasBackground) { - backgroundTextureID = texturesHandler.getTextureIDReference(_backgroundImage, GLFormat.rgba(), _backgroundImageName, false); + backgroundTextureID = texturesHandler.getTextureIDReference(_backgroundImage, GLFormat.rgba(), _backgroundImageName, false, GLTextureParameterValue.clampToEdge()); if (backgroundTextureID == null) { diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/INativeGL.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/INativeGL.java index c48ef6bea5..d82c26a1f1 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/INativeGL.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/INativeGL.java @@ -139,6 +139,7 @@ public void dispose() public abstract int TextureParameterValue_LinearMipmapLinear(); public abstract int TextureParameterValue_ClampToEdge(); + public abstract int TextureParameterValue_Repeat(); public abstract int Alignment_Pack(); public abstract int Alignment_Unpack(); diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/Mark.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/Mark.java index e18907a50a..20d00a3a6b 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/Mark.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/Mark.java @@ -895,7 +895,7 @@ public final void render(G3MRenderContext rc, MutableVector3D cameraPosition, do { if ((_textureId == null) && (_textureImage != null)) { - _textureId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _imageID, false); + _textureId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _imageID, false, GLTextureParameterValue.clampToEdge()); _textureImage = null; _textureImage = null; diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MarkWidget.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MarkWidget.java index daca1d814f..c139378dc4 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MarkWidget.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MarkWidget.java @@ -75,7 +75,7 @@ private void prepareWidget(IImage image, String imageName) texCoords.add(0.0f, 0.0f); // vertex 3 texCoords.add(1.0f, 0.0f); // vertex 4 - final TextureIDReference textureID = _texHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false); + final TextureIDReference textureID = _texHandler.getTextureIDReference(_image, GLFormat.rgba(), _imageName, false, GLTextureParameterValue.clampToEdge()); // #warning TODO: share unit texCoords if (_textureMapping != null) diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MultiTexturedHUDQuadWidget.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MultiTexturedHUDQuadWidget.java index 309285dabd..88b912b9a7 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MultiTexturedHUDQuadWidget.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/MultiTexturedHUDQuadWidget.java @@ -55,7 +55,7 @@ private Mesh createMesh(G3MRenderContext rc) return null; } - final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image1, GLFormat.rgba(), _imageURL1._path, false); + final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_image1, GLFormat.rgba(), _imageURL1._path, false, GLTextureParameterValue.clampToEdge()); if (texId == null) { @@ -63,7 +63,7 @@ private Mesh createMesh(G3MRenderContext rc) return null; } - final TextureIDReference texId2 = rc.getTexturesHandler().getTextureIDReference(_image2, GLFormat.rgba(), _imageURL2._path, false); + final TextureIDReference texId2 = rc.getTexturesHandler().getTextureIDReference(_image2, GLFormat.rgba(), _imageURL2._path, false, GLTextureParameterValue.clampToEdge()); if (texId2 == null) { diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/QuadShape.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/QuadShape.java index b69427493b..a9341a8589 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/QuadShape.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/QuadShape.java @@ -40,7 +40,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc) return null; } - final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false); + final TextureIDReference texId = rc.getTexturesHandler().getTextureIDReference(_textureImage, GLFormat.rgba(), _textureURL._path, false, GLTextureParameterValue.clampToEdge()); _textureImage = null; _textureImage = null; diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/SGLayerNode.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/SGLayerNode.java index e1bef6908d..c39b819d7f 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/SGLayerNode.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/SGLayerNode.java @@ -43,7 +43,7 @@ private TextureIDReference getTextureId(G3MRenderContext rc) if (_downloadedImage != null) { final boolean generateMipmap = false; - _textureId = rc.getTexturesHandler().getTextureIDReference(_downloadedImage, GLFormat.rgba(), getURL()._path, generateMipmap); + _textureId = rc.getTexturesHandler().getTextureIDReference(_downloadedImage, GLFormat.rgba(), getURL()._path, generateMipmap, GLTextureParameterValue.clampToEdge()); _downloadedImage = null; _downloadedImage = null; diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TextureSpec.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TextureSpec.java index db919288dc..792c67053f 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TextureSpec.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TextureSpec.java @@ -31,6 +31,7 @@ public class TextureSpec private final int _width; private final int _height; private final boolean _generateMipmap; + private final int _wrapMode; //C++ TO JAVA CONVERTER TODO TASK: The implementation of the following method could not be found: // TextureSpec operator =(TextureSpec that); @@ -41,6 +42,17 @@ public TextureSpec(String id, int width, int height, boolean generateMipmap) _width = width; _height = height; _generateMipmap = generateMipmap; + _wrapMode = GLTextureParameterValue.clampToEdge(); + + } + + public TextureSpec(String id, int width, int height, boolean generateMipmap, int wrapMode) + { + _id = id; + _width = width; + _height = height; + _generateMipmap = generateMipmap; + _wrapMode = wrapMode; } @@ -50,6 +62,7 @@ public TextureSpec() _width = 0; _height = 0; _generateMipmap = false; + _wrapMode = GLTextureParameterValue.clampToEdge(); } public TextureSpec(TextureSpec that) @@ -58,6 +71,7 @@ public TextureSpec(TextureSpec that) _width = that._width; _height = that._height; _generateMipmap = that._generateMipmap; + _wrapMode = that._wrapMode; } @@ -76,9 +90,14 @@ public final int getHeight() return _height; } + public final int getWrapMode() + { + return _wrapMode; + } + public final boolean equalsTo(TextureSpec that) { - return ((_id.compareTo(that._id) == 0) && (_width == that._width) && (_height == that._height)); + return ((_id.compareTo(that._id) == 0) && (_width == that._width) && (_height == that._height) && (_wrapMode == that._wrapMode)); } public final boolean lowerThan(TextureSpec that) @@ -132,6 +151,7 @@ public int hashCode() { result = prime * result + _height; result = prime * result + ((_id == null) ? 0 : _id.hashCode()); result = prime * result + _width; + result = prime * result + _wrapMode; return result; } @@ -153,6 +173,8 @@ public boolean equals(Object obj) { return false; if (_width != other._width) return false; + if (_wrapMode != other._wrapMode) + return false; return true; } } \ No newline at end of file diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturedBoxShape.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturedBoxShape.java new file mode 100644 index 0000000000..91472968ec --- /dev/null +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturedBoxShape.java @@ -0,0 +1,373 @@ + + +package org.glob3.mobile.generated; + +// +// TexturedBoxShape.cpp +// G3MiOSSDK +// +// Created by Diego Gomez Deck on 11/16/12. +// +// + +// +// TexturedBoxShape.hpp +// G3MiOSSDK +// +// Created by Diego Gomez Deck on 11/16/12. +// +// + + +public class TexturedBoxShape + extends + AbstractMeshShape { + private double _extentX; + private double _extentY; + private double _extentZ; + + private final Quadric _frontQuadric; + private final Quadric _backQuadric; + private final Quadric _leftQuadric; + private final Quadric _rightQuadric; + private final Quadric _topQuadric; + private final Quadric _bottomQuadric; + + private float _borderWidth; + + private final IImage _image; + private final String _imageName; + private Color _borderColor; + private final Vector3F _textureRepetitions; + + + private Mesh createBorderMesh(final G3MRenderContext rc) { + final float lowerX = (float) -(_extentX / 2); + final float upperX = (float) +(_extentX / 2); + final float lowerY = (float) -(_extentY / 2); + final float upperY = (float) +(_extentY / 2); + final float lowerZ = (float) -(_extentZ / 2); + final float upperZ = (float) +(_extentZ / 2); + + final float[] v = { lowerX, lowerY, lowerZ, lowerX, upperY, lowerZ, lowerX, upperY, upperZ, lowerX, lowerY, upperZ, upperX, + lowerY, lowerZ, upperX, upperY, lowerZ, upperX, upperY, upperZ, upperX, lowerY, upperZ }; + + final int numIndices = 48; + final short[] i = { 0, 1, 1, 2, 2, 3, 3, 0, 1, 5, 5, 6, 6, 2, 2, 1, 5, 4, 4, 7, 7, 6, 6, 5, 4, 0, 0, 3, 3, 7, 7, 4, 3, 2, + 2, 6, 6, 7, 7, 3, 0, 1, 1, 5, 5, 4, 4, 0 }; + + final FloatBufferBuilderFromCartesian3D vertices = FloatBufferBuilderFromCartesian3D.builderWithoutCenter(); + final ShortBufferBuilder indices = new ShortBufferBuilder(); + + final int numVertices = 8; + for (int n = 0; n < numVertices; n++) { + vertices.add(v[n * 3], v[(n * 3) + 1], v[(n * 3) + 2]); + } + + for (int n = 0; n < numIndices; n++) { + indices.add(i[n]); + } + + final Color borderColor = (_borderColor != null) ? new Color(_borderColor) : new Color(Color.red()); + + final Mesh result = new IndexedMesh(GLPrimitive.lines(), vertices.getCenter(), vertices.create(), true, indices.create(), + true, (_borderWidth > 1) ? _borderWidth : 1, 1, borderColor); + + if (vertices != null) { + vertices.dispose(); + } + + return result; + } + + + // Mesh* createSurfaceMesh(const G3MRenderContext* rc); + + private Mesh createSurfaceMeshWithNormals(final G3MRenderContext rc) { + final float lowerX = (float) -(_extentX / 2); + final float upperX = (float) +(_extentX / 2); + final float lowerY = (float) -(_extentY / 2); + final float upperY = (float) +(_extentY / 2); + final float lowerZ = (float) -(_extentZ / 2); + final float upperZ = (float) +(_extentZ / 2); + + final FloatBufferBuilderFromCartesian3D vertices = FloatBufferBuilderFromCartesian3D.builderWithoutCenter(); + final FloatBufferBuilderFromCartesian3D normals = FloatBufferBuilderFromCartesian3D.builderWithoutCenter(); + + final float[] v = { lowerX, upperY, lowerZ, lowerX, upperY, upperZ, upperX, upperY, lowerZ, upperX, upperY, lowerZ, lowerX, + upperY, upperZ, upperX, upperY, upperZ, lowerX, lowerY, lowerZ, lowerX, lowerY, upperZ, upperX, lowerY, lowerZ, + upperX, lowerY, lowerZ, lowerX, lowerY, upperZ, upperX, lowerY, upperZ, lowerX, lowerY, upperZ, lowerX, upperY, + upperZ, upperX, lowerY, upperZ, upperX, lowerY, upperZ, lowerX, upperY, upperZ, upperX, upperY, upperZ, lowerX, + lowerY, lowerZ, lowerX, upperY, lowerZ, upperX, lowerY, lowerZ, upperX, lowerY, lowerZ, lowerX, upperY, lowerZ, + upperX, upperY, lowerZ, upperX, lowerY, lowerZ, upperX, lowerY, upperZ, upperX, upperY, lowerZ, upperX, upperY, + lowerZ, upperX, lowerY, upperZ, upperX, upperY, upperZ, lowerX, lowerY, lowerZ, lowerX, lowerY, upperZ, lowerX, + upperY, lowerZ, lowerX, upperY, lowerZ, lowerX, lowerY, upperZ, lowerX, upperY, upperZ }; + //FACE 1 + //FACE 2 + //FACE 3 + //FACE 4 + //FACE 5 + //FACE 6 + + + final float[] texCoords = { 0, 0, 0, _textureRepetitions._y, _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, + _textureRepetitions._y, _textureRepetitions._x, _textureRepetitions._y, 0, 0, 0, _textureRepetitions._y, + _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, _textureRepetitions._y, _textureRepetitions._x, + _textureRepetitions._y, 0, 0, 0, _textureRepetitions._z, _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, + _textureRepetitions._z, _textureRepetitions._x, _textureRepetitions._z, 0, 0, 0, _textureRepetitions._z, + _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, _textureRepetitions._z, _textureRepetitions._x, + _textureRepetitions._z, 0, 0, 0, _textureRepetitions._y, _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, + _textureRepetitions._y, _textureRepetitions._x, _textureRepetitions._y, 0, 0, 0, _textureRepetitions._y, + _textureRepetitions._x, 0, _textureRepetitions._x, 0, 0, _textureRepetitions._y, _textureRepetitions._x, + _textureRepetitions._y }; + //FACE 1 + //FACE 2 + //FACE 3 + //FACE 4 + //FACE 5 + //FACE 6 + + final float[] n = { 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 1, 0, 0, -1, 0, 0 }; + //FACE 1 + //FACE 2 + //FACE 3 + //FACE 4 + //FACE 5 + //FACE 6 + + + final int numFaces = 6; + final int numVertices = 6 * numFaces; + + for (int i = 0; i < numVertices; i++) { + vertices.add(v[i * 3], v[(i * 3) + 1], v[(i * 3) + 2]); + } + + final FloatBufferBuilderFromCartesian2D texC = new FloatBufferBuilderFromCartesian2D(); + for (int i = 0; i < numVertices; i++) { + texC.add(texCoords[i * 2], texCoords[(i * 2) + 1]); + + } + + final TextureIDReference texID = rc.getTexturesHandler().getTextureIDReference(_image, GLFormat.rgba(), _imageName, true, + GLTextureParameterValue.repeat()); + + final TextureMapping tm = new SimpleTextureMapping(texID, texC.create(), true, false); + + for (int i = 0; i < numFaces; i++) { + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + normals.add(n[i * 3], n[(i * 3) + 1], n[(i * 3) + 2]); + } + + + final Mesh result = new DirectMesh(GLPrimitive.triangles(), true, vertices.getCenter(), vertices.create(), + (_borderWidth > 1) ? _borderWidth : 1, 1, null, null, 1, true, normals.create()); + + if (vertices != null) { + vertices.dispose(); + } + if (normals != null) { + normals.dispose(); + } + + final TexturedMesh texMesh = new TexturedMesh(result, true, tm, true, false); + + + return texMesh; + } + + + @Override + protected final Mesh createMesh(final G3MRenderContext rc) { + + final Mesh surface = createSurfaceMeshWithNormals(rc); + + if (_borderWidth > 0) { + final CompositeMesh compositeMesh = new CompositeMesh(); + compositeMesh.addMesh(surface); + compositeMesh.addMesh(createBorderMesh(rc)); + return compositeMesh; + } + + return surface; + } + + + public TexturedBoxShape(final Geodetic3D position, + final AltitudeMode altitudeMode, + final Vector3D extent, + final float borderWidth, + final IImage image, + final String imageName, + final Vector3F textureRepetitions) { + this(position, altitudeMode, extent, borderWidth, image, imageName, textureRepetitions, null); + } + + + public TexturedBoxShape(final Geodetic3D position, + final AltitudeMode altitudeMode, + final Vector3D extent, + final float borderWidth, + final IImage image, + final String imageName, + final Vector3F textureRepetitions, + final Color borderColor) { + super(position, altitudeMode); + _extentX = extent._x; + _extentY = extent._y; + _extentZ = extent._z; + _frontQuadric = Quadric.fromPlane(1, 0, 0, -extent._x / 2); + _backQuadric = Quadric.fromPlane(-1, 0, 0, -extent._x / 2); + _leftQuadric = Quadric.fromPlane(0, -1, 0, -extent._y / 2); + _rightQuadric = Quadric.fromPlane(0, 1, 0, -extent._y / 2); + _topQuadric = Quadric.fromPlane(0, 0, 1, -extent._z / 2); + _bottomQuadric = Quadric.fromPlane(0, 0, -1, -extent._z / 2); + _borderWidth = borderWidth; + _borderColor = borderColor; + _image = image; + _imageName = imageName; + _textureRepetitions = new Vector3F(textureRepetitions); + + } + + + @Override + public void dispose() { + if (_image != null) { + _image.dispose(); + } + if (_borderColor != null) { + _borderColor.dispose(); + } + + super.dispose(); + } + + + public final void setExtent(final Vector3D extent) { + if ((_extentX != extent._x) || (_extentY != extent._y) || (_extentZ != extent._z)) { + _extentX = extent._x; + _extentY = extent._y; + _extentZ = extent._z; + cleanMesh(); + } + } + + + public final Vector3D getExtent() { + return new Vector3D(_extentX, _extentY, _extentZ); + } + + + public final void setBorderColor(final Color color) { + if (_borderColor != null) { + _borderColor.dispose(); + } + _borderColor = color; + cleanMesh(); + } + + + public final void setBorderWidth(final float borderWidth) { + if (_borderWidth != borderWidth) { + _borderWidth = borderWidth; + cleanMesh(); + } + } + + + @Override + public final java.util.ArrayList intersectionsDistances(final Planet planet, + final Vector3D origin, + final Vector3D direction) { + final java.util.ArrayList distances = new java.util.ArrayList(); + + double tmin = -1e10; + double tmax = 1e10; + double t1; + double t2; + // transform 6 planes + final MutableMatrix44D M = createTransformMatrix(planet); + final Quadric transformedFront = _frontQuadric.transformBy(M); + final Quadric transformedBack = _backQuadric.transformBy(M); + final Quadric transformedLeft = _leftQuadric.transformBy(M); + final Quadric transformedRight = _rightQuadric.transformBy(M); + final Quadric transformedTop = _topQuadric.transformBy(M); + final Quadric transformedBottom = _bottomQuadric.transformBy(M); + if (M != null) { + M.dispose(); + } + + // intersecction with X planes + final java.util.ArrayList frontDistance = transformedFront.intersectionsDistances(origin, direction); + final java.util.ArrayList backDistance = transformedBack.intersectionsDistances(origin, direction); + if ((frontDistance.size() == 1) && (backDistance.size() == 1)) { + if (frontDistance.get(0) < backDistance.get(0)) { + t1 = frontDistance.get(0); + t2 = backDistance.get(0); + } + else { + t2 = frontDistance.get(0); + t1 = backDistance.get(0); + } + if (t1 > tmin) { + tmin = t1; + } + if (t2 < tmax) { + tmax = t2; + } + } + + // intersections with Y planes + final java.util.ArrayList leftDistance = transformedLeft.intersectionsDistances(origin, direction); + final java.util.ArrayList rightDistance = transformedRight.intersectionsDistances(origin, direction); + if ((leftDistance.size() == 1) && (rightDistance.size() == 1)) { + if (leftDistance.get(0) < rightDistance.get(0)) { + t1 = leftDistance.get(0); + t2 = rightDistance.get(0); + } + else { + t2 = leftDistance.get(0); + t1 = rightDistance.get(0); + } + if (t1 > tmin) { + tmin = t1; + } + if (t2 < tmax) { + tmax = t2; + } + } + + // intersections with Z planes + final java.util.ArrayList topDistance = transformedTop.intersectionsDistances(origin, direction); + final java.util.ArrayList bottomDistance = transformedBottom.intersectionsDistances(origin, direction); + if ((topDistance.size() == 1) && (bottomDistance.size() == 1)) { + if (topDistance.get(0) < bottomDistance.get(0)) { + t1 = topDistance.get(0); + t2 = bottomDistance.get(0); + } + else { + t2 = topDistance.get(0); + t1 = bottomDistance.get(0); + } + if (t1 > tmin) { + tmin = t1; + } + if (t2 < tmax) { + tmax = t2; + } + } + + if (tmin < tmax) { + distances.add(tmin); + distances.add(tmax); + } + + return distances; + } + +} diff --git a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturesHandler.java b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturesHandler.java index c6c76b17c5..b2691e52ea 100644 --- a/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturesHandler.java +++ b/Commons/G3MSharedSDK/src/org/glob3/mobile/generated/TexturesHandler.java @@ -59,10 +59,10 @@ public void dispose() } } - public final TextureIDReference getTextureIDReference(IImage image, int format, String name, boolean generateMipmap) + public final TextureIDReference getTextureIDReference(IImage image, int format, String name, boolean generateMipmap, int wrapMode) { - final TextureSpec textureSpec = new TextureSpec(name, image.getWidth(), image.getHeight(), generateMipmap); + final TextureSpec textureSpec = new TextureSpec(name, image.getWidth(), image.getHeight(), generateMipmap, wrapMode); final IGLTextureId previousId = getGLTextureIdIfAvailable(textureSpec); if (previousId != null) @@ -71,7 +71,7 @@ public final TextureIDReference getTextureIDReference(IImage image, int format, } TextureHolder holder = new TextureHolder(textureSpec); - holder._glTextureId = _gl.uploadTexture(image, format, textureSpec.generateMipmap()); + holder._glTextureId = _gl.uploadTexture(image, format, textureSpec.generateMipmap(), wrapMode); if (_verbose) diff --git a/WebGL/G3MWebGLSDK/src/org/glob3/mobile/specific/NativeGL_WebGL.java b/WebGL/G3MWebGLSDK/src/org/glob3/mobile/specific/NativeGL_WebGL.java index 7740f25056..575139ec5e 100644 --- a/WebGL/G3MWebGLSDK/src/org/glob3/mobile/specific/NativeGL_WebGL.java +++ b/WebGL/G3MWebGLSDK/src/org/glob3/mobile/specific/NativeGL_WebGL.java @@ -496,6 +496,12 @@ public native int TextureParameterValue_ClampToEdge() /*-{ }-*/; + @Override + public native int TextureParameterValue_Repeat() /*-{ + return this.@org.glob3.mobile.specific.NativeGL_WebGL::_gl.REPEAT; + }-*/; + + @Override public native int Alignment_Pack() /*-{ return this.@org.glob3.mobile.specific.NativeGL_WebGL::_gl.PACK_ALIGNMENT; diff --git a/iOS/G3MApp/G3MApp.xcodeproj/project.pbxproj b/iOS/G3MApp/G3MApp.xcodeproj/project.pbxproj index 9d0eb41663..f39f6d19a7 100644 --- a/iOS/G3MApp/G3MApp.xcodeproj/project.pbxproj +++ b/iOS/G3MApp/G3MApp.xcodeproj/project.pbxproj @@ -584,7 +584,7 @@ ORGANIZATIONNAME = "Igo Software SL"; TargetAttributes = { E7D1B60416D2436700AF47C1 = { - DevelopmentTeam = N847RXR927; + DevelopmentTeam = CTLLY45L74; }; }; }; diff --git a/iOS/G3MApp/G3MApp/G3M3DSymbologyDemoScene.cpp b/iOS/G3MApp/G3MApp/G3M3DSymbologyDemoScene.cpp index 82cae86fca..420d6edce2 100644 --- a/iOS/G3MApp/G3MApp/G3M3DSymbologyDemoScene.cpp +++ b/iOS/G3MApp/G3MApp/G3M3DSymbologyDemoScene.cpp @@ -23,6 +23,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include + + #include "G3MDemoModel.hpp" @@ -82,6 +90,38 @@ void G3M3DSymbologyDemoScene::rawSelectOption(const std::string& option, int optionIndex) { } +class MyIImageBuilderListener: public IImageBuilderListener{ + + ShapesRenderer* _sr; + +public: + + MyIImageBuilderListener(ShapesRenderer* sr):_sr(sr){} + + virtual void imageCreated(const IImage* image, + const std::string& imageName){ + + const double boxExtent = 20000; + const double baseArea = boxExtent * boxExtent; + const double volume = 1e7 * boxExtent * 3500; + const double height = volume / baseArea; + + TexturedBoxShape* bs = new TexturedBoxShape(new Geodetic3D(Geodetic3D::fromDegrees(28.124823,-15.430006, 0)), + RELATIVE_TO_GROUND, + Vector3D(boxExtent / 4, boxExtent / 4, height / 2), + 2, + image, + imageName, + Vector3F(1,15,1), + NULL); + _sr->addShape(bs); + } + + virtual void onError(const std::string& error){ + + } +}; + void G3M3DSymbologyDemoScene::rawActivate(const G3MContext* context) { G3MDemoModel* model = getModel(); G3MWidget* g3mWidget = model->getG3MWidget(); @@ -95,11 +135,16 @@ void G3M3DSymbologyDemoScene::rawActivate(const G3MContext* context) { planetRenderer->setElevationDataProvider(elevationDataProvider, true); - MapBoxLayer* rasterLayer = new MapBoxLayer("examples.map-qogxobv1", - TimeInterval::fromDays(30), - true, - 3); - model->getLayerSet()->addLayer(rasterLayer); +// MapBoxLayer* rasterLayer = new MapBoxLayer("examples.map-qogxobv1", +// TimeInterval::fromDays(30), +// true, +// 3); +// model->getLayerSet()->addLayer(rasterLayer); +// + BingMapsLayer* layer = new BingMapsLayer(BingMapType::Aerial(), + "AnU5uta7s5ql_HTrRZcPLI4_zotvNefEeSxIClF1Jf7eS-mLig1jluUdCoecV7jc", + TimeInterval::fromDays(30)); + model->getLayerSet()->addLayer(layer); GEOVectorLayer* vectorLayer = new GEOVectorLayer(); model->getLayerSet()->addLayer(vectorLayer); @@ -110,6 +155,13 @@ void G3M3DSymbologyDemoScene::rawActivate(const G3MContext* context) { geoRenderer->setGEOVectorLayer(vectorLayer, false); geoRenderer->loadJSON(URL("file:///uscitieslite.geojson"), new USCitiesSymbolizer()); + + + //Texture Wrapping demo + DownloaderImageBuilder* dib = new DownloaderImageBuilder(URL("http://www.bricksntiles.com/textures/brickwork-texture.jpg")); + dib->build(g3mWidget->getG3MContext(), new MyIImageBuilderListener(getModel()->getShapesRenderer()), true); + /// + g3mWidget->setAnimatedCameraPosition(TimeInterval::fromSeconds(5), Geodetic3D::fromDegrees(25.5, -74.52, 1595850), diff --git a/iOS/G3MiOSSDK/Commons/Basic/DefaultTileTexturizer.cpp b/iOS/G3MiOSSDK/Commons/Basic/DefaultTileTexturizer.cpp index 5a54175f5a..aab64987f9 100644 --- a/iOS/G3MiOSSDK/Commons/Basic/DefaultTileTexturizer.cpp +++ b/iOS/G3MiOSSDK/Commons/Basic/DefaultTileTexturizer.cpp @@ -225,7 +225,8 @@ class DTT_TileTextureBuilder : public RCObject { const TextureIDReference* glTextureId = texturesHandler->getTextureIDReference(backgroundTileImage, GLFormat::rgba(), backgroundTileImageName, - generateMipmap); + generateMipmap, + GLTextureParameterValue::clampToEdge()); mapping->setGLTextureId(glTextureId); //Mandatory to active mapping mappings->push_back(mapping); @@ -335,7 +336,8 @@ class DTT_TileTextureBuilder : public RCObject { const TextureIDReference* glTextureId = _texturesHandler->getTextureIDReference(image, GLFormat::rgba(), imageId, - _generateMipmap); + _generateMipmap, + GLTextureParameterValue::clampToEdge()); if (glTextureId == NULL) { return false; } diff --git a/iOS/G3MiOSSDK/Commons/Basic/Mark.cpp b/iOS/G3MiOSSDK/Commons/Basic/Mark.cpp index 69dd3810f0..f0859ab1cc 100644 --- a/iOS/G3MiOSSDK/Commons/Basic/Mark.cpp +++ b/iOS/G3MiOSSDK/Commons/Basic/Mark.cpp @@ -736,7 +736,8 @@ void Mark::render(const G3MRenderContext* rc, _textureId = rc->getTexturesHandler()->getTextureIDReference(_textureImage, GLFormat::rgba(), _imageID, - false); + false, + GLTextureParameterValue::clampToEdge()); delete _textureImage; _textureImage = NULL; diff --git a/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.cpp b/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.cpp index 000eff902b..61a1196153 100644 --- a/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.cpp +++ b/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.cpp @@ -114,16 +114,17 @@ const IGLTextureId* TexturesHandler::getGLTextureIdIfAvailable(const TextureSpec return NULL; } - const TextureIDReference* TexturesHandler::getTextureIDReference(const IImage* image, int format, const std::string& name, - bool generateMipmap) { + bool generateMipmap, + int wrapMode) { const TextureSpec textureSpec(name, image->getWidth(), image->getHeight(), - generateMipmap); + generateMipmap, + wrapMode); const IGLTextureId* previousId = getGLTextureIdIfAvailable(textureSpec); if (previousId != NULL) { @@ -133,7 +134,7 @@ const TextureIDReference* TexturesHandler::getTextureIDReference(const IImage* i } TextureHolder* holder = new TextureHolder(textureSpec); - holder->_glTextureId = _gl->uploadTexture(image, format, textureSpec.generateMipmap()); + holder->_glTextureId = _gl->uploadTexture(image, format, textureSpec.generateMipmap(), wrapMode); if (_verbose) { diff --git a/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.hpp b/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.hpp index 6a118f3334..c25d00aa70 100644 --- a/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.hpp +++ b/iOS/G3MiOSSDK/Commons/Basic/TexturesHandler.hpp @@ -12,6 +12,7 @@ #include #include "INativeGL.hpp" +#include "GLConstants.hpp" class IImage; class G3MRenderContext; @@ -28,6 +29,7 @@ class TextureSpec { const int _width; const int _height; const bool _generateMipmap; + const int _wrapMode; TextureSpec& operator=(const TextureSpec& that); @@ -39,18 +41,34 @@ class TextureSpec { _id(id), _width(width), _height(height), - _generateMipmap(generateMipmap) + _generateMipmap(generateMipmap), + _wrapMode(GLTextureParameterValue::clampToEdge()) { } - TextureSpec():_id(""), _width(0),_height(0), _generateMipmap(false) {} + TextureSpec(const std::string& id, + const int width, + const int height, + const bool generateMipmap, + const int wrapMode): + _id(id), + _width(width), + _height(height), + _generateMipmap(generateMipmap), + _wrapMode(wrapMode) + { + + } + + TextureSpec():_id(""), _width(0),_height(0), _generateMipmap(false), _wrapMode(GLTextureParameterValue::clampToEdge()) {} TextureSpec(const TextureSpec& that): _id(that._id), _width(that._width), _height(that._height), - _generateMipmap(that._generateMipmap) + _generateMipmap(that._generateMipmap), + _wrapMode(that._wrapMode) { } @@ -67,10 +85,15 @@ class TextureSpec { return _height; } + int getWrapMode() const { + return _wrapMode; + } + bool equalsTo(const TextureSpec& that) const { return ((_id.compare(that._id) == 0) && (_width == that._width) && - (_height == that._height)); + (_height == that._height) && + (_wrapMode == that._wrapMode)); } bool lowerThan(const TextureSpec& that) const { @@ -113,6 +136,7 @@ class TextureSpec { result = prime * result + _height; result = prime * result + ((_id == null) ? 0 : _id.hashCode()); result = prime * result + _width; + result = prime * result + _wrapMode; return result; } @@ -134,6 +158,8 @@ class TextureSpec { return false; if (_width != other._width) return false; + if (_wrapMode != other._wrapMode) + return false; return true; } #endif @@ -164,7 +190,8 @@ class TexturesHandler { const TextureIDReference* getTextureIDReference(const IImage* image, int format, const std::string& name, - bool generateMipmap); + bool generateMipmap, + int wrapMode); //This two methods are supposed to be accessed only by TextureIDReference class diff --git a/iOS/G3MiOSSDK/Commons/GL/GL.cpp b/iOS/G3MiOSSDK/Commons/GL/GL.cpp index 63e2759616..a874275d1c 100644 --- a/iOS/G3MiOSSDK/Commons/GL/GL.cpp +++ b/iOS/G3MiOSSDK/Commons/GL/GL.cpp @@ -109,7 +109,8 @@ bool GL::isPowerOfTwo(int x) { const IGLTextureId* GL::uploadTexture(const IImage* image, int format, - bool generateMipmap) { + bool generateMipmap, + int wrapMode) { // if (_verbose) { // ILogger::instance()->logInfo("GL::uploadTexture()"); @@ -142,13 +143,12 @@ const IGLTextureId* GL::uploadTexture(const IImage* image, GLTextureParameter::magFilter(), linear); - const int clampToEdge = GLTextureParameterValue::clampToEdge(); _nativeGL->texParameteri(texture2D, GLTextureParameter::wrapS(), - clampToEdge); + wrapMode); _nativeGL->texParameteri(texture2D, GLTextureParameter::wrapT(), - clampToEdge); + wrapMode); _nativeGL->texImage2D(image, format); diff --git a/iOS/G3MiOSSDK/Commons/GL/GL.hpp b/iOS/G3MiOSSDK/Commons/GL/GL.hpp index 6e36fb6291..e5ed7c0af3 100644 --- a/iOS/G3MiOSSDK/Commons/GL/GL.hpp +++ b/iOS/G3MiOSSDK/Commons/GL/GL.hpp @@ -117,7 +117,8 @@ class GL { const IGLTextureId* uploadTexture(const IImage* image, int format, - bool generateMipmap); + bool generateMipmap, + int wrapMode); void deleteTexture(const IGLTextureId* textureId); diff --git a/iOS/G3MiOSSDK/Commons/GL/GLConstants.cpp b/iOS/G3MiOSSDK/Commons/GL/GLConstants.cpp index ae3a6eacb7..2e869a7131 100644 --- a/iOS/G3MiOSSDK/Commons/GL/GLConstants.cpp +++ b/iOS/G3MiOSSDK/Commons/GL/GLConstants.cpp @@ -61,6 +61,7 @@ int GLTextureParameterValue::_linearMipmapNearest = 0; int GLTextureParameterValue::_linearMipmapLinear = 0; int GLTextureParameterValue::_clampToEdge = 0; +int GLTextureParameterValue::_repeat = 0; int GLAlignment::_pack = 0; int GLAlignment::_unpack = 0; diff --git a/iOS/G3MiOSSDK/Commons/GL/GLConstants.hpp b/iOS/G3MiOSSDK/Commons/GL/GLConstants.hpp index c9acdd8c42..5d842af3f8 100644 --- a/iOS/G3MiOSSDK/Commons/GL/GLConstants.hpp +++ b/iOS/G3MiOSSDK/Commons/GL/GLConstants.hpp @@ -220,6 +220,7 @@ class GLTextureParameterValue { static int _linearMipmapLinear; static int _clampToEdge; + static int _repeat; public: @@ -231,7 +232,8 @@ class GLTextureParameterValue { static int linearMipmapLinear() { return _linearMipmapLinear; } static int clampToEdge() { return _clampToEdge; } - + static int repeat() { return _repeat; } + static void init(const INativeGL* ngl) { _nearest = ngl->TextureParameterValue_Nearest(); _linear = ngl->TextureParameterValue_Linear(); @@ -241,6 +243,7 @@ class GLTextureParameterValue { _linearMipmapLinear = ngl->TextureParameterValue_LinearMipmapLinear(); _clampToEdge = ngl->TextureParameterValue_ClampToEdge(); + _repeat = ngl->TextureParameterValue_Repeat(); } }; diff --git a/iOS/G3MiOSSDK/Commons/Interfaces/INativeGL.hpp b/iOS/G3MiOSSDK/Commons/Interfaces/INativeGL.hpp index 34be1b4c3f..e1d6bb540a 100644 --- a/iOS/G3MiOSSDK/Commons/Interfaces/INativeGL.hpp +++ b/iOS/G3MiOSSDK/Commons/Interfaces/INativeGL.hpp @@ -172,6 +172,7 @@ class INativeGL { virtual int TextureParameterValue_LinearMipmapLinear() const = 0; virtual int TextureParameterValue_ClampToEdge() const = 0; + virtual int TextureParameterValue_Repeat() const = 0; virtual int Alignment_Pack() const = 0; virtual int Alignment_Unpack() const = 0; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/BusyQuadRenderer.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/BusyQuadRenderer.cpp index 1149afd778..6a2e2ecdda 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/BusyQuadRenderer.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/BusyQuadRenderer.cpp @@ -53,7 +53,8 @@ bool BusyQuadRenderer::initMesh(const G3MRenderContext* rc) { texId = rc->getTexturesHandler()->getTextureIDReference(_image, GLFormat::rgba(), "BusyQuadRenderer-Texture", - false); + false, + GLTextureParameterValue::clampToEdge()); if (texId == NULL) { rc->getLogger()->logError("Can't upload texture to GPU"); diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/EllipsoidShape.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/EllipsoidShape.cpp index 8823214cb2..68f4551e7b 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/EllipsoidShape.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/EllipsoidShape.cpp @@ -48,7 +48,8 @@ const TextureIDReference* EllipsoidShape::getTextureId(const G3MRenderContext* r _texId = rc->getTexturesHandler()->getTextureIDReference(_textureImage, GLFormat::rgba(), _textureURL._path, - false); + false, + GLTextureParameterValue::clampToEdge()); delete _textureImage; _textureImage = NULL; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/HUDImageRenderer.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/HUDImageRenderer.cpp index 9d7e1f3a8e..79b0b17706 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/HUDImageRenderer.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/HUDImageRenderer.cpp @@ -123,7 +123,8 @@ Mesh* HUDImageRenderer::createMesh(const G3MRenderContext* rc) { const TextureIDReference* texId = rc->getTexturesHandler()->getTextureIDReference(_image, GLFormat::rgba(), textureName, - false); + false, + GLTextureParameterValue::clampToEdge()); delete _image; _image = NULL; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp index 09d746d842..b278e007a3 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/HUDQuadWidget.cpp @@ -84,7 +84,8 @@ Mesh* HUDQuadWidget::createMesh(const G3MRenderContext* rc) { const TextureIDReference* textureID = texturesHandler->getTextureIDReference(_image, GLFormat::rgba(), _imageName, - false); + false, + GLTextureParameterValue::clampToEdge()); if (textureID == NULL) { rc->getLogger()->logError("Can't upload texture to GPU"); return NULL; @@ -100,7 +101,8 @@ Mesh* HUDQuadWidget::createMesh(const G3MRenderContext* rc) { backgroundTextureID = texturesHandler->getTextureIDReference(_backgroundImage, GLFormat::rgba(), _backgroundImageName, - false); + false, + GLTextureParameterValue::clampToEdge()); if (backgroundTextureID == NULL) { delete textureID; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/MultiTexturedHUDQuadWidget.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/MultiTexturedHUDQuadWidget.cpp index 327ad69fb2..5028e3bb6d 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/MultiTexturedHUDQuadWidget.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/MultiTexturedHUDQuadWidget.cpp @@ -72,7 +72,8 @@ Mesh* MultiTexturedHUDQuadWidget::createMesh(const G3MRenderContext* rc) { const TextureIDReference* texId = rc->getTexturesHandler()->getTextureIDReference(_image1, GLFormat::rgba(), _imageURL1._path, - false); + false, + GLTextureParameterValue::clampToEdge()); if (texId == NULL) { rc->getLogger()->logError("Can't upload texture to GPU"); @@ -82,7 +83,8 @@ Mesh* MultiTexturedHUDQuadWidget::createMesh(const G3MRenderContext* rc) { const TextureIDReference* texId2 = rc->getTexturesHandler()->getTextureIDReference(_image2, GLFormat::rgba(), _imageURL2._path, - false); + false, + GLTextureParameterValue::clampToEdge()); if (texId2 == NULL) { rc->getLogger()->logError("Can't upload texture to GPU"); diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/NonOverlappingMarksRenderer.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/NonOverlappingMarksRenderer.cpp index 3093477697..f377daa52f 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/NonOverlappingMarksRenderer.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/NonOverlappingMarksRenderer.cpp @@ -117,7 +117,8 @@ void MarkWidget::prepareWidget(const IImage* image, const TextureIDReference* textureID = _texHandler->getTextureIDReference(_image, GLFormat::rgba(), _imageName, - false); + false, + GLTextureParameterValue::clampToEdge()); // #warning TODO: share unit texCoords if (_textureMapping != NULL) { diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/QuadShape.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/QuadShape.cpp index 89532ff869..46c5c3c5be 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/QuadShape.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/QuadShape.cpp @@ -30,7 +30,8 @@ const TextureIDReference* QuadShape::getTextureId(const G3MRenderContext* rc) { const TextureIDReference* texId = rc->getTexturesHandler()->getTextureIDReference(_textureImage, GLFormat::rgba(), _textureURL._path, - false); + false, + GLTextureParameterValue::clampToEdge()); delete _textureImage; _textureImage = NULL; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/SGLayerNode.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/SGLayerNode.cpp index 5103a3e50b..05fba0e713 100644 --- a/iOS/G3MiOSSDK/Commons/Rendererers/SGLayerNode.cpp +++ b/iOS/G3MiOSSDK/Commons/Rendererers/SGLayerNode.cpp @@ -110,7 +110,8 @@ const TextureIDReference* SGLayerNode::getTextureId(const G3MRenderContext* rc) _textureId = rc->getTexturesHandler()->getTextureIDReference(_downloadedImage, GLFormat::rgba(), getURL()._path, - generateMipmap); + generateMipmap, + GLTextureParameterValue::clampToEdge()); delete _downloadedImage; _downloadedImage = NULL; diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.cpp b/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.cpp new file mode 100644 index 0000000000..5921681b32 --- /dev/null +++ b/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.cpp @@ -0,0 +1,370 @@ +// +// TexturedBoxShape.cpp +// G3MiOSSDK +// +// Created by Diego Gomez Deck on 11/16/12. +// +// + +#include "TexturedBoxShape.hpp" + +#include "FloatBufferBuilderFromCartesian3D.hpp" +#include "ShortBufferBuilder.hpp" +#include "IndexedMesh.hpp" +#include "GLConstants.hpp" +#include "CompositeMesh.hpp" +#include "DirectMesh.hpp" +#include "TexturedMesh.hpp" +#include "FloatBufferBuilderFromCartesian2D.hpp" +#include "SimpleTextureMapping.hpp" +#include "TexturesHandler.hpp" + + +Mesh* TexturedBoxShape::createBorderMesh(const G3MRenderContext* rc) { + const float lowerX = (float) -(_extentX / 2); + const float upperX = (float) +(_extentX / 2); + const float lowerY = (float) -(_extentY / 2); + const float upperY = (float) +(_extentY / 2); + const float lowerZ = (float) -(_extentZ / 2); + const float upperZ = (float) +(_extentZ / 2); + + float v[] = { + lowerX, lowerY, lowerZ, + lowerX, upperY, lowerZ, + lowerX, upperY, upperZ, + lowerX, lowerY, upperZ, + upperX, lowerY, lowerZ, + upperX, upperY, lowerZ, + upperX, upperY, upperZ, + upperX, lowerY, upperZ + }; + + const int numIndices = 48; + short i[] = { + 0, 1, 1, 2, 2, 3, 3, 0, + 1, 5, 5, 6, 6, 2, 2, 1, + 5, 4, 4, 7, 7, 6, 6, 5, + 4, 0, 0, 3, 3, 7, 7, 4, + 3, 2, 2, 6, 6, 7, 7, 3, + 0, 1, 1, 5, 5, 4, 4, 0 + }; + + FloatBufferBuilderFromCartesian3D* vertices = FloatBufferBuilderFromCartesian3D::builderWithoutCenter(); + ShortBufferBuilder indices; + + const unsigned int numVertices = 8; + for (unsigned int n=0; nadd(v[n*3], v[n*3+1], v[n*3+2]); + } + + for (unsigned int n=0; ngetCenter(), + vertices->create(), + true, + indices.create(), + true, + (_borderWidth>1)? _borderWidth : 1, + 1, + borderColor); + + delete vertices; + + return result; +} + +Mesh* TexturedBoxShape::createSurfaceMeshWithNormals(const G3MRenderContext* rc) { + const float lowerX = (float) -(_extentX / 2); + const float upperX = (float) +(_extentX / 2); + const float lowerY = (float) -(_extentY / 2); + const float upperY = (float) +(_extentY / 2); + const float lowerZ = (float) -(_extentZ / 2); + const float upperZ = (float) +(_extentZ / 2); + + FloatBufferBuilderFromCartesian3D* vertices = FloatBufferBuilderFromCartesian3D::builderWithoutCenter(); + FloatBufferBuilderFromCartesian3D* normals = FloatBufferBuilderFromCartesian3D::builderWithoutCenter(); + + const float v[] = { + //FACE 1 + lowerX, upperY, lowerZ, + lowerX, upperY, upperZ, + upperX, upperY, lowerZ, + + upperX, upperY, lowerZ, + lowerX, upperY, upperZ, + upperX, upperY, upperZ, + + //FACE 2 + lowerX, lowerY, lowerZ, + lowerX, lowerY, upperZ, + upperX, lowerY, lowerZ, + + upperX, lowerY, lowerZ, + lowerX, lowerY, upperZ, + upperX, lowerY, upperZ, + + //FACE 3 + lowerX, lowerY, upperZ, + lowerX, upperY, upperZ, + upperX, lowerY, upperZ, + + upperX, lowerY, upperZ, + lowerX, upperY, upperZ, + upperX, upperY, upperZ, + + //FACE 4 + lowerX, lowerY, lowerZ, + lowerX, upperY, lowerZ, + upperX, lowerY, lowerZ, + + upperX, lowerY, lowerZ, + lowerX, upperY, lowerZ, + upperX, upperY, lowerZ, + + //FACE 5 + upperX, lowerY, lowerZ, + upperX, lowerY, upperZ, + upperX, upperY, lowerZ, + + upperX, upperY, lowerZ, + upperX, lowerY, upperZ, + upperX, upperY, upperZ, + + //FACE 6 + lowerX, lowerY, lowerZ, + lowerX, lowerY, upperZ, + lowerX, upperY, lowerZ, + + lowerX, upperY, lowerZ, + lowerX, lowerY, upperZ, + lowerX, upperY, upperZ, + }; + + + + const float texCoords[] = { + //FACE 1 + 0, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, _textureRepetitions._y, + + //FACE 2 + 0, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, _textureRepetitions._y, + + //FACE 3 + 0, 0, + 0, _textureRepetitions._z, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._z, + _textureRepetitions._x, _textureRepetitions._z, + + //FACE 4 + 0, 0, + 0, _textureRepetitions._z, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._z, + _textureRepetitions._x, _textureRepetitions._z, + + //FACE 5 + 0, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, _textureRepetitions._y, + + //FACE 6 + 0, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, 0, + + _textureRepetitions._x, 0, + 0, _textureRepetitions._y, + _textureRepetitions._x, _textureRepetitions._y, + }; + + const float n[] = { + //FACE 1 + 0, 1, 0, + //FACE 2 + 0, -1, 0, + //FACE 3 + 0, 0, 1, + //FACE 4 + 0, 0, -1, + //FACE 5 + 1, 0, 0, + //FACE 6 + -1, 0, 0 + }; + + + const unsigned int numFaces = 6; + const unsigned int numVertices = 6 * numFaces; + + for (unsigned int i=0; iadd(v[i*3], v[i*3+1], v[i*3+2]); + } + + FloatBufferBuilderFromCartesian2D texC; + for (unsigned int i=0; igetTexturesHandler()->getTextureIDReference(_image, + GLFormat::rgba(), + _imageName, + true, + GLTextureParameterValue::repeat()); + + TextureMapping* tm = new SimpleTextureMapping(texID, + texC.create(), + true, + false); + + for (unsigned int i=0; iadd(n[i*3], n[i*3+1], n[i*3+2]); + normals->add(n[i*3], n[i*3+1], n[i*3+2]); + normals->add(n[i*3], n[i*3+1], n[i*3+2]); + normals->add(n[i*3], n[i*3+1], n[i*3+2]); + normals->add(n[i*3], n[i*3+1], n[i*3+2]); + normals->add(n[i*3], n[i*3+1], n[i*3+2]); + } + + + Mesh* result = new DirectMesh(GLPrimitive::triangles(), + true, + vertices->getCenter(), + vertices->create(), + (_borderWidth>1)? _borderWidth : 1, + 1, + NULL, + NULL, + 1, + true, + normals->create()); + + delete vertices; + delete normals; + + TexturedMesh* texMesh = new TexturedMesh(result, true, + tm, + true, + false); + + + return texMesh; +} + + +Mesh* TexturedBoxShape::createMesh(const G3MRenderContext* rc) { + + Mesh* surface = createSurfaceMeshWithNormals(rc); + + if (_borderWidth > 0) { + CompositeMesh* compositeMesh = new CompositeMesh(); + compositeMesh->addMesh(surface); + compositeMesh->addMesh(createBorderMesh(rc)); + return compositeMesh; + } + + return surface; +} + +std::vector TexturedBoxShape::intersectionsDistances(const Planet* planet, + const Vector3D& origin, + const Vector3D& direction) const { + std::vector distances; + + double tmin=-1e10, tmax=1e10; + double t1, t2; + // transform 6 planes + MutableMatrix44D* M = createTransformMatrix(planet); + const Quadric transformedFront = _frontQuadric.transformBy(*M); + const Quadric transformedBack = _backQuadric.transformBy(*M); + const Quadric transformedLeft = _leftQuadric.transformBy(*M); + const Quadric transformedRight = _rightQuadric.transformBy(*M); + const Quadric transformedTop = _topQuadric.transformBy(*M); + const Quadric transformedBottom = _bottomQuadric.transformBy(*M); + delete M; + + // intersecction with X planes + std::vector frontDistance = transformedFront.intersectionsDistances(origin, direction); + std::vector backDistance = transformedBack.intersectionsDistances(origin, direction); + if (frontDistance.size()==1 && backDistance.size()==1) { + if (frontDistance[0] < backDistance[0]) { + t1 = frontDistance[0]; + t2 = backDistance[0]; + } else { + t2 = frontDistance[0]; + t1 = backDistance[0]; + } + if (t1 > tmin) + tmin = t1; + if (t2 < tmax) + tmax = t2; + } + + // intersections with Y planes + std::vector leftDistance = transformedLeft.intersectionsDistances(origin, direction); + std::vector rightDistance = transformedRight.intersectionsDistances(origin, direction); + if (leftDistance.size()==1 && rightDistance.size()==1) { + if (leftDistance[0] < rightDistance[0]) { + t1 = leftDistance[0]; + t2 = rightDistance[0]; + } else { + t2 = leftDistance[0]; + t1 = rightDistance[0]; + } + if (t1 > tmin) + tmin = t1; + if (t2 < tmax) + tmax = t2; + } + + // intersections with Z planes + std::vector topDistance = transformedTop.intersectionsDistances(origin, direction); + std::vector bottomDistance = transformedBottom.intersectionsDistances(origin, direction); + if (topDistance.size()==1 && bottomDistance.size()==1) { + if (topDistance[0] < bottomDistance[0]) { + t1 = topDistance[0]; + t2 = bottomDistance[0]; + } else { + t2 = topDistance[0]; + t1 = bottomDistance[0]; + } + if (t1 > tmin) + tmin = t1; + if (t2 < tmax) + tmax = t2; + } + + if (tmin < tmax) { + distances.push_back(tmin); + distances.push_back(tmax); + } + + return distances; +} + diff --git a/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.hpp b/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.hpp new file mode 100644 index 0000000000..bd9714948c --- /dev/null +++ b/iOS/G3MiOSSDK/Commons/Rendererers/TexturedBoxShape.hpp @@ -0,0 +1,134 @@ +// +// TexturedBoxShape.hpp +// G3MiOSSDK +// +// Created by Diego Gomez Deck on 11/16/12. +// +// + +#ifndef __G3MiOSSDK__TexturedBoxShape__ +#define __G3MiOSSDK__TexturedBoxShape__ + +#include "AbstractMeshShape.hpp" +#include "Color.hpp" +#include "Planet.hpp" +#include "Quadric.hpp" +#include "TextureIDReference.hpp" + + +class TexturedBoxShape : public AbstractMeshShape { +private: + double _extentX; + double _extentY; + double _extentZ; + +#ifdef C_CODE + const Quadric _frontQuadric; + const Quadric _backQuadric; + const Quadric _leftQuadric; + const Quadric _rightQuadric; + const Quadric _topQuadric; + const Quadric _bottomQuadric; +#endif +#ifdef JAVA_CODE + private final Quadric _frontQuadric; + private final Quadric _backQuadric; + private final Quadric _leftQuadric; + private final Quadric _rightQuadric; + private final Quadric _topQuadric; + private final Quadric _bottomQuadric; +#endif + + float _borderWidth; + + const IImage* _image; + const std::string _imageName; + Color* _borderColor; + +#ifdef C_CODE + const Vector3F _textureRepetitions; +#endif +#ifdef JAVA_CODE + private final Vector3F _textureRepetitions; +#endif + + Mesh* createBorderMesh(const G3MRenderContext* rc); +// Mesh* createSurfaceMesh(const G3MRenderContext* rc); + + Mesh* createSurfaceMeshWithNormals(const G3MRenderContext* rc); + +protected: + Mesh* createMesh(const G3MRenderContext* rc); + +public: + TexturedBoxShape(Geodetic3D* position, + AltitudeMode altitudeMode, + const Vector3D& extent, + float borderWidth, + const IImage* image, + const std::string& imageName, + const Vector3F& textureRepetitions, + Color* borderColor = NULL) : + AbstractMeshShape(position, altitudeMode), + _extentX(extent._x), + _extentY(extent._y), + _extentZ(extent._z), + _frontQuadric(Quadric::fromPlane(1, 0, 0, -extent._x/2)), + _backQuadric(Quadric::fromPlane(-1, 0, 0, -extent._x/2)), + _leftQuadric(Quadric::fromPlane(0, -1, 0, -extent._y/2)), + _rightQuadric(Quadric::fromPlane(0, 1, 0, -extent._y/2)), + _topQuadric(Quadric::fromPlane(0, 0, 1, -extent._z/2)), + _bottomQuadric(Quadric::fromPlane(0, 0, -1, -extent._z/2)), + _borderWidth(borderWidth), + _borderColor(borderColor), + _image(image), + _imageName(imageName), + _textureRepetitions(textureRepetitions) + { + + } + + ~TexturedBoxShape() { + delete _image; + delete _borderColor; + +#ifdef JAVA_CODE + super.dispose(); +#endif + } + + void setExtent(const Vector3D& extent) { + if ((_extentX != extent._x) || + (_extentY != extent._y) || + (_extentZ != extent._z)) { + _extentX = extent._x; + _extentY = extent._y; + _extentZ = extent._z; + cleanMesh(); + } + } + + Vector3D getExtent() const { + return Vector3D(_extentX, _extentY, _extentZ); + } + + void setBorderColor(Color* color) { + delete _borderColor; + _borderColor = color; + cleanMesh(); + } + + void setBorderWidth(float borderWidth) { + if (_borderWidth != borderWidth) { + _borderWidth = borderWidth; + cleanMesh(); + } + } + + std::vector intersectionsDistances(const Planet* planet, + const Vector3D& origin, + const Vector3D& direction) const; + +}; + +#endif diff --git a/iOS/G3MiOSSDK/G3MiOSSDK.xcodeproj/project.pbxproj b/iOS/G3MiOSSDK/G3MiOSSDK.xcodeproj/project.pbxproj index 945e46e449..97f23b9da5 100644 --- a/iOS/G3MiOSSDK/G3MiOSSDK.xcodeproj/project.pbxproj +++ b/iOS/G3MiOSSDK/G3MiOSSDK.xcodeproj/project.pbxproj @@ -484,6 +484,8 @@ D81BA17115CBF19F004EF0B0 /* GL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D81BA16F15CBF19E004EF0B0 /* GL.cpp */; }; D81D2072160748EA009A8BA6 /* GLConstants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D81D2071160748EA009A8BA6 /* GLConstants.cpp */; }; D8228EBF157F7F7900BBAF60 /* MutableMatrix44D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D8228EBE157F7F7900BBAF60 /* MutableMatrix44D.cpp */; }; + D826764D1C774099008FD98E /* TexturedBoxShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D826764B1C774099008FD98E /* TexturedBoxShape.cpp */; }; + D826764E1C774128008FD98E /* TexturedBoxShape.hpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = D826764C1C774099008FD98E /* TexturedBoxShape.hpp */; }; D824A8561C295BCD002C84AA /* TimedCacheTileLODTester.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D824A8541C295BCD002C84AA /* TimedCacheTileLODTester.cpp */; }; D824A8591C296381002C84AA /* MaxFrameTimeTileLODTester.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D824A8571C296381002C84AA /* MaxFrameTimeTileLODTester.cpp */; }; D842D9AF1A727FAF008D55E4 /* NonOverlappingMarksRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D842D9AD1A727FAF008D55E4 /* NonOverlappingMarksRenderer.cpp */; }; @@ -762,6 +764,7 @@ dstPath = "include/${PRODUCT_NAME}"; dstSubfolderSpec = 16; files = ( + D826764E1C774128008FD98E /* TexturedBoxShape.hpp in CopyFiles */, CFE50D251C6669160002EFD5 /* GradualSplitsTileLODTester.hpp in CopyFiles */, CFE50D261C6669160002EFD5 /* PlanetRenderContext.hpp in CopyFiles */, CF75396B1C5C0501006CE697 /* OrTileLODTester.hpp in CopyFiles */, @@ -1787,6 +1790,8 @@ D81FB47C1636A5AE00CC2CA7 /* PeriodicalTask.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = PeriodicalTask.hpp; path = Commons/Basic/PeriodicalTask.hpp; sourceTree = ""; }; D8228EBC157F7F6100BBAF60 /* MutableMatrix44D.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = MutableMatrix44D.hpp; path = Commons/Geometry/MutableMatrix44D.hpp; sourceTree = ""; }; D8228EBE157F7F7900BBAF60 /* MutableMatrix44D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = MutableMatrix44D.cpp; path = Commons/Geometry/MutableMatrix44D.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + D826764B1C774099008FD98E /* TexturedBoxShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TexturedBoxShape.cpp; path = Commons/Rendererers/TexturedBoxShape.cpp; sourceTree = ""; }; + D826764C1C774099008FD98E /* TexturedBoxShape.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = TexturedBoxShape.hpp; path = Commons/Rendererers/TexturedBoxShape.hpp; sourceTree = ""; }; D824A8541C295BCD002C84AA /* TimedCacheTileLODTester.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TimedCacheTileLODTester.cpp; path = Commons/Rendererers/TimedCacheTileLODTester.cpp; sourceTree = ""; }; D824A8551C295BCD002C84AA /* TimedCacheTileLODTester.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = TimedCacheTileLODTester.hpp; path = Commons/Rendererers/TimedCacheTileLODTester.hpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; D824A8571C296381002C84AA /* MaxFrameTimeTileLODTester.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MaxFrameTimeTileLODTester.cpp; path = Commons/Rendererers/MaxFrameTimeTileLODTester.cpp; sourceTree = ""; }; @@ -2663,6 +2668,8 @@ CFEEE4BA1648676800F45F59 /* Shapes */ = { isa = PBXGroup; children = ( + D826764B1C774099008FD98E /* TexturedBoxShape.cpp */, + D826764C1C774099008FD98E /* TexturedBoxShape.hpp */, D89FBD7B1725444800FFA541 /* MeshShape.cpp */, D89FBD7C1725444800FFA541 /* MeshShape.hpp */, CF45E023164851C5004746BB /* AbstractMeshShape.cpp */, @@ -3214,6 +3221,7 @@ CF6B5F6916C1956B00C590C1 /* JSONLong.cpp in Sources */, E7EC944516C4F43300B32D9F /* DownloadPriority.cpp in Sources */, CF35DD4C16C6995D002EFC96 /* Vector3F.cpp in Sources */, + D826764D1C774099008FD98E /* TexturedBoxShape.cpp in Sources */, CF35DD5016C69B08002EFC96 /* Vector2F.cpp in Sources */, FB6D00A516CBFF3A009BF93D /* EllipsoidShape.cpp in Sources */, CFD3D8A116CFDD0000CE9242 /* FloatBufferBuilderFromGeodetic.cpp in Sources */, diff --git a/iOS/G3MiOSSDK/Specific/GL/NativeGL2_iOS.hpp b/iOS/G3MiOSSDK/Specific/GL/NativeGL2_iOS.hpp index 58213fc7a2..cf1b25c788 100644 --- a/iOS/G3MiOSSDK/Specific/GL/NativeGL2_iOS.hpp +++ b/iOS/G3MiOSSDK/Specific/GL/NativeGL2_iOS.hpp @@ -378,6 +378,10 @@ class NativeGL2_iOS: public INativeGL { int TextureParameterValue_ClampToEdge() const { return GL_CLAMP_TO_EDGE; } + + int TextureParameterValue_Repeat() const { + return GL_REPEAT; + } int Alignment_Pack() const { return GL_PACK_ALIGNMENT;