Skip to content

Commit

Permalink
Name hashed to color marker (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
begarco authored Feb 11, 2017
1 parent 59230cb commit 1cec7a9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3,302 deletions.
3,298 changes: 0 additions & 3,298 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public void onClick(View view) {
User futurMe = getIntent().getParcelableExtra("user");
this.users.setMe(futurMe);
getUsers().addObserver(renderer.getMap());
//this.users.addUser(new User("tito","Bob","","",null,false, new GPSPosition(3.111185f, 45.759231f, 0.0f)));
//this.users.addUser(new User("tata","Alice","","",null,false, new GPSPosition(3.111185f, 45.759271f, 0.5f)));


// login sur le serveur
Expand Down
15 changes: 14 additions & 1 deletion app/src/main/java/ovh/exception/watchdogzz/model/WDArtefact.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ public class WDArtefact implements WDDrawable {
private GPSPosition position;
private String label;
private String info;
private float r,g,b;

// Constructor - Setup the data-array buffers
public WDArtefact(Context context) {
objet = new WDObjet(WDObjet.Shape.CIRCLE, 0,0,0,0.05f,64);
this(context,"","");
}
public WDArtefact(Context context, String label, String info) {
this.objet = new WDObjet(WDObjet.Shape.CIRCLE, 0,0,0,0.05f,64);
this.setLabel(label);
this.setInfo(info);
}

// Render this shape
public void draw(GL10 gl) {
gl.glColor4f(r,g,b,1.0f);
objet.draw(gl);
}

Expand All @@ -40,6 +47,12 @@ public String getLabel() {

public void setLabel(String label) {
this.label = label;
int hash = label.hashCode();
r = (hash % 10)/10f;
hash/=10;
g = (hash % 10)/10f;
hash/=10;
b = (hash % 10)/10f;
}

public String getInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.microedition.khronos.opengles.GL10;

/**
* Created by begarco on 19/11/2016.
* Displayable objects interface
*/
public interface WDDrawable {
public void draw(GL10 gl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void draw(GL10 gl) {
float[] tmp = x.getPosition().getForMap(origin,3169.8f);
gl.glTranslatef(tmp[0],tmp[1], 0.5f);
Log.d("ME", x.getPosition().toString());

x.draw(gl);
gl.glPopMatrix();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
import static java.lang.Math.sin;

/**
* Created by begarco on 19/11/2016.
* Encapsulation of OpenGL 3D Objects
*/

public class WDObjet implements WDDrawable {
private FloatBuffer vertexBuffer; // Buffer for vertex-array
private ByteBuffer indexBuffer; // Buffer for index-array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void onDrawFrame(GL10 gl) {
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_SPECULAR, mat_specular_buf);
// Specular exponent 0~128 less rough
gl.glMaterialf(GL10.GL_FRONT_AND_BACK, GL10.GL_SHININESS, 96.0f);
gl.glEnable ( GL10.GL_COLOR_MATERIAL );

//The position of the light source
float[] light_position = {mLightX, mLightY, mLightZ, 0.0f};
Expand Down

0 comments on commit 1cec7a9

Please sign in to comment.