Git Product home page Git Product logo

pokemeow-renderer's Introduction

pokemeow-renderer's People

Contributors

zhangmenghe avatar

Stargazers

Cauê Alves avatar Zhengyao Li avatar Ruifan Yu avatar

Watchers

James Cloos avatar  avatar

Forkers

nrnb rico2004

pokemeow-renderer's Issues

[Implements] Mouse drag on Bezier Curve

Bezier curves have control points.
For example, quadric bezier curve holds one control point and the shape of curve is determined by the position of control point.
Users should be allowed to get their desire curve by dragging control point

[Enhancement] Unify range of coordinates in OpenGL

Sometimes renderer should open interface to set position. For example, to tackle with nodes and label, we offer an interface setOrigin to adjust original point.
Here we assume relative position. In this way, (x,y,z) coordinates between [-1,1] (NDC coordinates, OpenGL default use), with no relationship to viewport size.
Inside, we sometimes need switch between absolute pos and relative pos, I put it in commonUtil, see commit here

[SourceCode] How viewport and camera related to draw nodes?

  • Figure out how does viewport work with Camera.
  • Figure out how does viewport Listener and Camera Listener work.
  • Figure out how does viewport and Camera work with nodes(icons maybe).
  • Let Samples in debugDraw works in viewport.
  • Let Samples in debugDraw works with Camera.

[Implements][Reconstruct] Make full use of modelMatrix for edges

To make better use of GPU, compute absolute position using modelMatrix instead of doing it manually when it is possible. To be specific:

  • a.) Separate straight and curve line logic.
  • b.)For straight line, it's possible to use transformation: use scale/ translate/ rotating to convert a standard horizontal line with length = 1(-0.5<x<0.5) to any start/end position with any length.
  • c.) For curve line , points should be recomputed as before.
  • Samples for drawing straight / curve line are presented.

[Design] Hit Test for nodes / arrows

There are several ways to determine whether a point is inside polygon.
See wiki
Also, bounding box could used.
Roughly, the following methods could be applied:

  1. The axis-aligned minimum bounding box (or AABB) bounding box

  2. Object oriented minimum bounding box( OBB) see tutorial

  3. Ray-casting

4.Winding number algorithm (more precise but costly)

5.Just let the GPU do all the work for you.Use glReadPixel()

Create a painting surface that is off screen (so you can paint into it, without it appearing anywhere on the screen). Fill it completely with the color black. Now let OpenGL paint your polygon (or even all of your polygons if you just want to test if the point is within any of them, but you don't care for which one) into this drawing surface and fill the polygon(s) with a different color, e.g. white. To check if a point is within the polygon, get the color of this point from the drawing surface. This is just a O(1) memory fetch. If it's white, it's inside, if it's black, it's outside. Easy, isn't it? This method will pay off if you have very little polygons (e.g. 50-100), but a damn lot of points to test (> 1000), in which case this method is much speedier than anything else.

[Implements]Separate Node from its Buffer and Edge from its Buffer.

Previously, I assigned each object its own buffer(VBO / EBO if needed).When initialize the object, buffers are generated along vertices data passed.
However, to dynamically add /delete objects. This does't work fine for buffer has to be allocated(even though no data inside) before drawing.
Solution is:

  • a.)Design a large buffer object for nodes/ edges separately.
  • b.)Attach a factory with a such buffer object
  • c.)Pre-allocated N bytes space.When space not enough, double it.

Reference:

[Implements] Reconstruct demos

An independent demo should be named "XXXTest", while a uniform demo will be named "drawXXXDemo"
The independent demos are always auxiliary.
The uniform demos will be wrap to show in a uniform UI entrance.
Notice that after reconstruction, all demos will be allowed to use mouse event listener
see commits

[Implements][Enhancement] Depth Culling for nodes

Since there are no depth culling in 2D (all nodes face to camera).
Maybe use 3-channel texture.(Now texcoord only x,y)?
Zugzwang's document gives the idea to store per-pixel normal and light intensity, which is strange.

[Design] Is AGG needed?

Anti-Grain Geometry(AGG) can be used in many areas of computer programming where high quality 2D graphics is an essential part of the project.

To render high-quality and fast curve using fragment shader and perform very well for Anti-Aliasing.

Here are some reference:

  1. The idea is from the paper here
  2. To see the results:
  3. This is a replacement for stroke in [Java.awt] (https://docstore.mik.ua/orelly/java-ent/jfc/ch04_05.htm) which is used in Zugzwang.
    4.There is an example implementation in Python, Vispy library,

"....High-quality rendering of curves can be achieved using an OpenGL implementation of the Anti-grain Geometry (agg) library."

  1. Also , please refer to this blog for some details

The following is several circumstance we may want to use AGG:

  1. tackle with bend line
  2. hand written line

The unknown matter is the performance difference of pure OpenGL and OpenGL+AGG

[Bugs] UNEXPECTED effects for edge

  • After adjusting curve's src/dest pos, the combination of rotation and translation is not as expected
  • Sine Curve is not that good looking. feel bad. Try to use offset to straight to solve
  • Separate arrow line : translation is not that good

[Design] Find a best way to represent and draw NodeShape

In Zugzwang's work, contents in nodeshape folder just limit every single shape inside a rectangle.
In this way, define (xMin, xMax, yMin,yMax) as the border.
So inside the border, use java.awt to draw directly(like canvas for html).

This part should be replaced by drawing with gl4

[Tail~~~~] First week tail

  • nodeshapeFactory supports only one kind of texture. Set it a texture array for example.
  • path of resource. for debug, only put them in SampleTest, move them later.
  • viewport demo doesn't work as expect.issue

[Implements] Arrow shapes

Arrow is a part of edge. Like node shapes, previous version use awt draw while we want it compatible with gl4.

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.