Skip to content

Commit

Permalink
Fixes a bug with the dependency of variables. Corrects some models.
Browse files Browse the repository at this point in the history
Adds hints to OpenGL over the smoothness of lines, points and polygons.
  • Loading branch information
AlexisDrogoul committed Feb 24, 2020
1 parent 344894e commit 169ddb6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*******************************************************************************************************
*
* msi.gaml.expressions.AgentVariableExpression.java, in plugin msi.gama.core,
* is part of the source code of the GAMA modeling and simulation platform (v. 1.8)
*
* msi.gaml.expressions.AgentVariableExpression.java, in plugin msi.gama.core, is part of the source code of the GAMA
* modeling and simulation platform (v. 1.8)
*
* (c) 2007-2018 UMI 209 UMMISCO IRD/SU & Partners
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
*
********************************************************************************************************/
package msi.gaml.expressions;

Expand Down Expand Up @@ -66,7 +66,7 @@ public String getDocumentation() {

/**
* Method collectPlugins()
*
*
* @see msi.gama.common.interfaces.IGamlDescription#collectPlugins(java.util.Set)
*/
// @Override
Expand All @@ -79,7 +79,7 @@ public String getDocumentation() {
@Override
public void collectUsedVarsOf(final SpeciesDescription species, final ICollector<VariableDescription> result) {
final SpeciesDescription sd = this.getDefinitionDescription().getSpeciesContext();
if (species.equals(sd)) {
if (species.equals(sd) || species.hasParent(sd)) {
result.add(sd.getAttribute(getName()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ experiment "3D View" type: gui {
grid ant_grid elevation: grid_values triangulation: true texture: terrain refresh: false;
agents "Trail" transparency: 0.7 position: { 0.05, 0.05, 0.02 } size: { 0.9, 0.9 } value: (ant_grid as list) where ((each.food > 0) or (each.road > 0) or (each.is_nest)) ;
species ant position: { 0.05, 0.05, 0.025 } size: { 0.9, 0.9 } aspect: threeD;
light 1 type:point color:#yellow position:{world.shape.width*0.5 - world.shape.width*1.5,world.shape.width*0.5,world.shape.width} draw_light:true ;
light 1 type:point color:#white position:{world.shape.width*0.5 - world.shape.width*1.5,world.shape.width*0.5,world.shape.width} draw_light:false ;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,7 @@ species fruit {

experiment "Random" type: gui autorun: true {
output {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: false fullscreen: true camera_pos: {-66.4803, 275.5971, 235.9631}
camera_look_pos: {68.2571, 22.1928, 56.6337} camera_up_vector: {0.2488, 0.4679, 0.8481} {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: false fullscreen: true camera_pos: {50.0,249.6629,199.6559} camera_look_pos: {50.0,50.0,0.0} camera_up_vector: {0.0,0.7071,0.7071} {
species branch aspect: default;
species leaf aspect: default;
species trunk aspect: default;
Expand All @@ -423,8 +422,7 @@ experiment "4 simulations" type: gui autorun: true {
}

output {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: false camera_pos: {-57.3933, 202.0369, 246.4316} camera_look_pos:
{77.3441, 18.6326, 67.1022} camera_up_vector: {0.3664, 0.4988, 0.7854} {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: false camera_pos: {50.0,249.6629,199.6559} camera_look_pos: {50.0,50.0,0.0} camera_up_vector: {0.0,0.7071,0.7071} {
species branch aspect: default;
species leaf aspect: default;
species trunk aspect: default;
Expand All @@ -441,8 +439,7 @@ experiment L_Tri type: gui autorun: true {
float minimum_cycle_duration <- 0.0005;
float seed <- 0.05387546426306633;
output {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: true camera_pos: {-57.3933, 202.0369, 246.4316} camera_look_pos:
{77.3441, 18.6326, 67.1022} camera_up_vector: {0.3664, 0.4988, 0.7854} {
display 'Tree' type: opengl background: season.sky_color ambient_light: 150 draw_env: false toolbar: true camera_pos: {50.0,249.6629,199.6559} camera_look_pos: {50.0,50.0,0.0} camera_up_vector: {0.0,0.7071,0.7071} {
species branch aspect: default;
species leaf aspect: default;
species trunk aspect: default;
Expand Down
20 changes: 8 additions & 12 deletions ummisco.gama.opengl/src/ummisco/gama/opengl/OpenGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ public double getCurrentObjectAlpha() {
return currentObjectAlpha;
}


// TEXTURES

/**
Expand Down Expand Up @@ -1080,9 +1079,12 @@ public void initializeGLStates(final Color bg) {
// Turn on clockwise direction of vertices as an indication of "front" (important)
gl.glFrontFace(GL.GL_CW);

// Perspective correction
// Hints
gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);

gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
gl.glHint(GL2.GL_POINT_SMOOTH_HINT, GL.GL_NICEST);
gl.glHint(GL2.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST);
gl.glHint(GL2.GL_MULTISAMPLE_FILTER_HINT_NV, GL2.GL_NICEST);
// Enable texture 2D
gl.glEnable(GL.GL_TEXTURE_2D);
// Blending & alpha control
Expand All @@ -1092,23 +1094,17 @@ public void initializeGLStates(final Color bg) {
gl.glEnable(GL2.GL_ALPHA_TEST);
gl.glAlphaFunc(GL2.GL_GREATER, 0.01f);
// Disabling line smoothing to only rely on FSAA
gl.glDisable(GL.GL_LINE_SMOOTH);
gl.glEnable(GL.GL_LINE_SMOOTH);
gl.glEnable(GL2.GL_POINT_SMOOTH);
gl.glEnable(GL2.GL_POLYGON_SMOOTH);
// Enabling forced normalization of normal vectors (important)
gl.glEnable(GL2.GL_NORMALIZE);
// Enabling multi-sampling (necessary ?)
// if (USE_MULTI_SAMPLE) {
gl.glEnable(GL2.GL_MULTISAMPLE);
gl.glHint(GL2.GL_MULTISAMPLE_FILTER_HINT_NV, GL2.GL_NICEST);
// }
initializeShapeCache();

// SEE ALSO?
// GL.GL_SMOOTH_LINE_WIDTH_RANGE;
// GL.GL_SMOOTH_POINT_SIZE_RANGE;
// GL.GL_MAX_TEXTURE_SIZE;
// GL.GL_MAX_RENDERBUFFER_SIZE;
// GL.GL_LINE_SMOOTH_HINT;
// GL.GL_LINE_SMOOTH;
}

public GamaPoint getRatios() {
Expand Down

0 comments on commit 169ddb6

Please sign in to comment.