Recent Posts

Pages: [1] 2 3 ... 10
1
Support / Re: Cpct?
« Last post by EgonOlsen on April 12, 2021, 03:41:15 pm »
Good to hear that!
2
Support / Re: Cpct?
« Last post by AGP on April 09, 2021, 09:47:21 am »
The GLRenderer (not yet the AWT) is working! Yay.
3
Support / Re: Gradle support
« Last post by EgonOlsen on April 08, 2021, 12:06:28 pm »
I've no plans on adding anything like that, I'm afraid.
4
Support / Gradle support
« Last post by zammbi on April 08, 2021, 01:45:17 am »
Can we get Gradle support for JPCT-AE?
It would make things easier if you could install/update JPCT by Gradle. Also it would be nice to get notifications through Gradle when there are updates, so I don't have to keep manually checking :)
5
Support / Re: polyline fixed width
« Last post by Harald on April 02, 2021, 04:06:57 pm »
I just figured out the right way to do it (and the framerate is mostly stable with just a few drops to 45 frames per second on the android device)
EgonOlsens code helped me a lot (a huge thanks). To help people who will stumble across this I want to share the code I used to get an Endless Version of the code (and not continuing like EgonsOlsens version).
Beware when using this: With everything that looks like it is endless in programming there is a point where things break. So far I do not have a solution for this.

 This code is taking two scalable lists of vectors (called leftLine and rightLine) and create the data to follow by these two lists. The rest is kind of copy pasted or slightly changed.

Code: [Select]
import com.threed.jpct.*

class EndlessTrackArea(private val leftLine: EndlessTrackLine, private val rightLine: EndlessTrackLine) {
    private var trackObject = Object3D(TRACK_POLYGONS)
    private var trackCreator = TrackCreator(leftLine, rightLine)
    private var world: World? = null
    private var color = RGBColor(0,255,255,100)

    fun moveTrackArea(){
        if (trackCreator.pos >= trackCreator.destinationMesh.size -1){
            trackCreator = TrackCreator(leftLine, rightLine)
            setTrackArea()
        }
        trackObject.mesh.applyVertexController()
        trackObject.touch()
    }
    fun setAreaVariables(world: World, color: RGBColor = RGBColor(0,255,255,100)){
        this.world = world
        this.color = color
        setTrackArea()
    }

    private fun setTrackArea(){
        Logger.log("Creating Track Object")
        val trackObject = Object3D(TRACK_POLYGONS)

        for (i in 0 until TRACK_POLYGONS / 2){
            trackObject.addTriangle(
                SimpleVector(
                    (-1100000 + i).toDouble(), (-1200000 + i).toDouble(),
                    (-1300000 + i).toDouble()
                ), SimpleVector(
                    (-1400000 + i).toDouble(), (-1500000 + i).toDouble(),
                    (-1600000 + i).toDouble()
                ), SimpleVector(
                    (-1700000 + i).toDouble(), (-1800000 + i).toDouble(), (-1900000 + i).toDouble()
                )
            )
            trackObject.addTriangle(
                SimpleVector(
                    (2000000 + i).toDouble(),
                    (2100000 + i).toDouble(), (2200000 + i).toDouble()
                ), SimpleVector(
                    (2300000 + i).toDouble(), (2400000 + i).toDouble(),
                    (2500000 + i).toDouble()
                ), SimpleVector(
                    (2600000 + i).toDouble(),
                    (2700000 + i).toDouble(), (2800000 + i).toDouble()
                )
            )
        }
        trackObject.calcNormals()
        trackObject.mesh.setVertexController(trackCreator, false)
        trackObject.forceGeometryIndices(false)
        trackObject.compile(true)
        trackObject.build()
        trackObject.additionalColor = color
        trackObject.culling = Object3D.CULLING_DISABLED
        trackObject.transparency = 10
        world!!.addObject(trackObject)

        this.trackObject = trackObject
    }
    companion object{
        const val TRACK_POLYGONS = 100
    }
    private class TrackCreator(private val leftLine: EndlessTrackLine,private val rightLine: EndlessTrackLine): GenericVertexController(){

       var pos = 0

        override fun apply() {
            //this is some crazy testing
            //lines
            val left = leftLine.line
            val right = rightLine.line
            if (left.size > 2 && right.size > 2){
                //points of the lines
                val backLeft = left[left.size -2]
                val backRight = right[right.size -2]
                val frontLeft = left[left.size -1]
                val frontRight = right[right.size -1]

                if (pos + 4 >= destinationMesh.size -1){
                    pos = 0
                }
                destinationMesh[pos++].set(backLeft) //0
                destinationMesh[pos++].set(backRight) //1
                destinationMesh[pos++].set(frontRight) //3
                destinationMesh[pos++].set(frontLeft) //2
                destinationMesh[pos++].set(backLeft) //0
                destinationMesh[pos++].set(frontRight) //3

            }
        }

        companion object {
            private const val serialVersionUID = 1L
        }
    }
}
6
News / Re: Version 1.32 has been released!
« Last post by AeroShark333 on March 29, 2021, 11:30:25 pm »
Amazing! :D

Thank you for the continuous support on the library!
Very stable and full of functionalities
7
Projects / Re: Art of Earthify (3D live wallpaper)
« Last post by AeroShark333 on March 29, 2021, 11:28:56 pm »
The Android live wallpaper on a PC emulator:
https://imgur.com/a/LUkHPCj
8
Support / Re: Cpct?
« Last post by EgonOlsen on March 25, 2021, 09:55:31 pm »
No, that doesn't look like a problem in the model's setup...at least not as the sole reason of the problem. But it's actually impossible to tell what's going on there. Maybe some other GL setup going wrong, but it will be quite hard to find out. I would add a log output to every GL call in the Java version and then compare the trace that this produces with the same thing taken from the C# version while rendering the exact same scene. And then see, if there is a difference between the calls that these versions do. It will be quite a lot of work, I suppose, but you need some kind of reference to track this down and currently, you have none.
9
Support / Re: Cpct?
« Last post by AGP on March 25, 2021, 09:00:00 pm »
The reason that I don't think that that's it, other than the fact that I didn't change what you did, is that no matter what model I test this is what I get:
https://www.youtube.com/watch?v=Pfuo77vKUbo
10
Support / Re: polyline fixed width
« Last post by Harald on March 25, 2021, 07:04:44 pm »
This looks pretty promising. I will get into this as soon asI have some moe time (probably around easter) I am working on a full time job while programming this at the moment. This is also the reason for the slow response time.

I try to find a way to get a (nearly) unlimited area covered by adding some additional tricks

My code creates polygons on the fly and adds them to the world in runtime. Like I said before I know that this is a bad implementation and was just for testing purposes.
It looks like this: (its kotlin as well)

Code: [Select]
fun createTrackLines(world: World){
        trackLineLeft = EndlessTrackLine(world, RGBColor(0,255,0,100), 5f)
        trackLineRight = EndlessTrackLine(world, RGBColor(0,255,255,100), 5f)
    }

    fun trackMovementWithLines(movingObject: Object3D){
        if (equipment != null){
            val width = equipment.part1Width * MyRenderer.UNIT_TO_MM_RATIO
            val offset = width / 2
            trackLineLeft.trackMovement(movingObject, mainObject, -offset)
            trackLineRight.trackMovement(movingObject,mainObject, offset)
        }
    }

    //this drops the framerate
    fun createTrackObject(world: World){
        val trackObject = Object3D(2)
        if (equipment != null){
            //lines
            val left = trackLineLeft.line
            val right = trackLineRight.line
            if (left.size > 2 && right.size > 2){
                //vectors
                val backLeft = left[left.size -2]
                val backRight = right[right.size -2]
                val frontLeft = left[left.size -1]
                val frontRight = right[right.size -1]
                //triangles
                trackObject.addTriangle(backLeft, backRight, frontRight)
                trackObject.addTriangle(frontRight, frontLeft, backLeft)
                trackObject.setTexture("colSecondary")
                //trackObject.transparency = 10 //todo: add this once everything is tested

                trackObject.build()
                world.addObject(trackObject)
            }

        }
    }

the createTrackObject function is executed every 10 frames.
Pages: [1] 2 3 ... 10