Giter Club home page Giter Club logo

tiny-wings's Introduction

tiny-wings's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tiny-wings's Issues

EXC_BAD_ACCESS crash (when too many hills are visible?)

It crashes on this line: hillVertices[nHillVertices] = (ccVertex2F){pt1.x, pt1.y-(float)textureSize/vSegments*k}; inside Terrain.mm. When the debugger stops me at that line, nHillVertices is some huge number like 1107978021, outside the bounds of the array.

I would have thought that this is related to dividing by 0, but k is initialized to 0 in each iteration, and this crash only happens when I get high in the air and can see alot of hills, so I guess it's not that.

Here's a screenshot of how the game looks when it crashes:

screenshot 2013 09 28 11 51 30

Here's the surrounding code:

nHillVertices = 0;
ccVertex2F p0, p1, pt0, pt1;
p0 = hillKeyPoints[fromKeyPointI];
for (int i=fromKeyPointI+1; i<toKeyPointI+1; i++) {
    p1 = hillKeyPoints[i];

    // triangle strip between p0 and p1
    int hSegments = floorf((p1.x-p0.x)/kHillSegmentWidth);
    int vSegments = 1;
    float dx = (p1.x - p0.x) / hSegments;
    float da = M_PI / hSegments;
    float ymid = (p0.y + p1.y) / 2;
    float ampl = (p0.y - p1.y) / 2;
    pt0 = p0;
    for (int j=1; j<hSegments+1; j++) {
            pt1.x = p0.x + j*dx;
            pt1.y = ymid + ampl * cosf(da*j);
            for (int k=0; k<vSegments+1; k++) {
                hillVertices[nHillVertices] = (ccVertex2F){pt0.x, pt0.y-(float)textureSize/vSegments*k};
                hillTexCoords[nHillVertices++] = (ccVertex2F){pt0.x/(float)textureSize, (float)(k)/vSegments};
                hillVertices[nHillVertices] = (ccVertex2F){pt1.x, pt1.y-(float)textureSize/vSegments*k};
                hillTexCoords[nHillVertices++] = (ccVertex2F){pt1.x/(float)textureSize, (float)(k)/vSegments};
            }
            pt0 = pt1;
        }

        p0 = p1;
    }

Cocos2d-x

Can you make it to cocos2d-x?
´cause I´d like to try it on Android

Procedural Terrain Texture Alpha Issue

I have been reviewing this code for procedural texture generation and seeing how the ground mechanism can be revised. I zoomed out to 0.75 scale and I want to know why the very last triangle appears to be drawn faded as if the highlight method of the render texture does not apply to it. I simply cannot diagnose the root cause and it is driving me absolutely crazy!

It is most noticeable on the very first vertex drawn on the left of the scene and changes over time so presumably is an issue in the resetHillVertices method.

I can only disable the impact of these two triangles by calling glBlend(GL_ONE, GL_ZERO) which makes the hill look really dull.

Setting the vertices used to draw the RenderHighlight to a size significantly larger on the x axis than the texture has no impact on the size of the translucent looking bit.

I have played around with the texture coordinates for the generated vertices with no success as yet can anyone explain this behaviour? I would really like to understand the cause better. I analysed this for a while and it is both the first and last triangles drawn that suffer from this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.