Marking SOL

The place to discuss creating, porting and modifying Celestia's source code.
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #21by chris » 18.09.2006, 16:05

phoenix wrote:
Cham wrote:Is this code integrated in CVS right now ?

I don't think so.
But as chris said he was going to add this.


I just committed Vincent's arrow markers patch to CVS.

--Chris

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #22by Cham » 18.09.2006, 18:19

Chris,

what about the asterisk and the circle ?

To be honnest, I don't really care much about the arrows (I don't see how I'll be using them). However, a circular marker should be very usefull, especially if the user could define its radius.

For example, I'm already using most markers styles (square, plus, etc) in my start.cel, to mark all Messier objects and stars with exoplanets.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #23by Vincent » 18.09.2006, 18:57

chris wrote:I just committed Vincent's arrow markers patch to CVS.
That is good news.
As for the transparency option (I really don't want to bother you :wink: ), I coded it with very few changes. And one application in celx script could be to mark objects with different values of transparency relative to their distance from the observer. You would get the same perspective effect as you have with Fridger's new galaxy/star label rendering, but available via markers for any sub-group of objects. Here's a patch :

Code: Select all

Index: src/celengine/cmdparser.cpp
===================================================================
RCS file: /cvsroot/celestia/celestia/src/celengine/cmdparser.cpp,v
retrieving revision 1.32
diff -u -r1.32 cmdparser.cpp
--- src/celengine/cmdparser.cpp   29 Aug 2006 19:09:41 -0000   1.32
+++ src/celengine/cmdparser.cpp   17 Sep 2006 12:19:15 -0000
@@ -575,7 +575,9 @@
         paramList->getNumber("size", size);
         Vec3d colorv(1.0f, 0.0f, 0.0f);
         paramList->getVector("color", colorv);
        Color color((float) colorv.x, (float) colorv.y, (float) colorv.z, 0.9f);
+        double alpha = 0.9f;
+        paramList->getNumber("alpha", alpha);
+        Color color((float) colorv.x, (float) colorv.y, (float) colorv.z, alpha);
 
         Marker::Symbol symbol = Marker::Diamond;
         string symbolString;
Index: src/celestia/celx.cpp
===================================================================
RCS file: /cvsroot/celestia/celestia/src/celestia/celx.cpp,v
retrieving revision 1.84
diff -u -r1.84 celx.cpp
--- src/celestia/celx.cpp   29 Aug 2006 19:20:55 -0000   1.84
+++ src/celestia/celx.cpp   17 Sep 2006 12:21:36 -0000
@@ -2491,7 +2499,7 @@
 
 static int object_mark(lua_State* l)
 {
-    checkArgs(l, 1, 4, "No arguments expected to function object:mark");
+    checkArgs(l, 2, 5, "No arguments expected to function object:mark");
 
     Selection* sel = this_object(l);
     CelestiaCore* appCore = getAppCore(l, AllErrors);
@@ -2512,9 +2520,18 @@
     else if (markSize > 10000.0f)
         markSize = 10000.0f;
 
+    float markAlpha = (float)safeGetNumber(l, 5, WrongType, "Fourth arg to object:mark must be a number", 0.9);
+    if (markAlpha < 0.0f)
+        markAlpha = 0.0f;
+    else if (markAlpha > 1.0f)
+        markAlpha = 1.0f;
+
+    Color markColorAlpha(1.0f, 0.0f, 0.0f, 0.9f);
+    markColorAlpha = Color::Color(markColor, markAlpha);
+
     Simulation* sim = appCore->getSimulation();
     sim->getUniverse()->markObject(*sel, markSize,
-                                   markColor, markSymbol, 1);
+                                   markColorAlpha, markSymbol, 1);
 
     return 0;
 }


Cham wrote:Chris,

what about the asterisk and the circle ?

Circles and asterisks could be added very easily. But the point is to know whether these new forms are really usefull. Their shapes are very close to the other markers' shape. Why not using the same type of marker (diamond, square...) but with different colours ?
Last edited by Vincent on 19.09.2006, 08:21, edited 2 times in total.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #24by Cham » 18.09.2006, 19:07

Vincent wrote:Circles and asterisk could be added very easily. But the point is to know whether these new forms are really usefull. Their shapes are very close to the other marker's shape. Why not using the same type of marker (diamond, square) but with different colours ?


Of course, that's what I'm already doing. I used several sizes and colors styles to mark different objects. But a circle could be usefull, in the sense that's it's a "natural" shape with a good psychological impact. It's more visible than the "plus" or the "diamond", for example. The circle could be used to place something in evidence, a bit like your arrows, but with a more "natural" feel. And since I'm using all the actual symbols (to mark special stars, stars with exoplanets, Messier objects, pulsars and black holes, etc ), there isn't enough choice right now.

I can go without the "asterisk". But the circle is a must, IMHO, as a basic marker shape.

Those markers are also extremelly usefull to show the spatial distribution of special objects (pulsars, or all the barred galaxies, for example).
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #25by Cham » 22.09.2006, 23:14

Vincent,

I just tried your arrows markers. They are working, except the transparency. Changing the alpha value actually changes the color ! No transparency effect. For example, I used this small script to mark Sol :

Code: Select all

{
mark { object "Sol" size 32 color [ 1 1 0 0.5] symbol "uparrow" }
}


I also tried this :

Code: Select all

{
mark { object "Sol" size 32 color [ 1 1 0] alpha 0.5 symbol "uparrow" }
}


In all cases it doesn't have any effect on transparency. What is going on ?

Oh, I also noticed that giving a color value less than 1 may gives some transparency. For example :

Code: Select all

{
mark { object "Sol" size 32 color [ 0.5 0.5 0] symbol "uparrow" }
}


But I'm not sure to understand how transparencies are supposed to work here.

EDIT : And what about the offset option ? It doesn't work, apparently. I think the arrow should keep a distance from the object (Earth, in your example on the first page), so when you get closer, the arrow don't place itself inside the object. I think it should work the way you intended.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #26by Vincent » 23.09.2006, 07:55

Cham wrote:Vincent,

I just tried your arrows markers. They are working, except the transparency. Changing the alpha value actually changes the color ! No transparency effect.
Cham,

The current CVS version doesn't include the transparency option for markers. If you want to test it, you have to modify the code using the patch I posted above.

This patch is very short. So, it would be safer to apply it manually since the CVS version is often changing at the moment. Here's an example about how to read and use it :

Code: Select all

Index: src/celengine/cmdparser.cpp
===================================================================
RCS file: /cvsroot/celestia/celestia/src/celengine/cmdparser.cpp,v
retrieving revision 1.32
diff -u -r1.32 cmdparser.cpp
--- src/celengine/cmdparser.cpp   29 Aug 2006 19:09:41 -0000   1.32
+++ src/celengine/cmdparser.cpp   17 Sep 2006 12:19:15 -0000
> Open the ".../src/celengine/cmdparser.cpp" file with a text editor.

Code: Select all

@@ -575,7 +575,9 @@
> Go to the line ~575 (that may vary according to the version you're using...)

Code: Select all

         paramList->getNumber("size", size);
         Vec3d colorv(1.0f, 0.0f, 0.0f);
         paramList->getVector("color", colorv);
        Color color((float) colorv.x, (float) colorv.y, (float) colorv.z, 0.9f);
> These lines are given as an indicator. Don't modify them.

Code: Select all

+        double alpha = 0.9f;
+        paramList->getNumber("alpha", alpha);
+        Color color((float) colorv.x, (float) colorv.y, (float) colorv.z, alpha);
These lines are preceeded by a "+". That means you have to add them in the code.


Then, further in the patch, the file "src/celestia/celx.cpp" must be modified according to these lines of the patch :

Code: Select all

-    checkArgs(l, 1, 4, "No arguments expected to function object:mark");
+    checkArgs(l, 2, 5, "No arguments expected to function object:mark");
> That means you must remove the line that is preceeded by the "-", and replace it with (= add) the line that is preceeded by the "+"

Then, as for the use of the transparency argument :
Cham wrote:I also tried this :

Code: Select all

{
mark { object "Sol" size 32 color [ 1 1 0] alpha 0.5 symbol "uparrow" }
}
This is the good way to use the alpha argument in cel scripts.


Cham wrote:EDIT : And what about the offset option ? It doesn't work, apparently. I think the arrow should keep a distance from the object (Earth, in your example on the first page), so when you get closer, the arrow don't place itself inside the object. I think it should work the way you intended.
The offset argument is included neither in the CVS version nor in my patch... Adding an offset argument that would vary relative to the distance, and so, that would need to be resized each time you mover the camera, would require a lot of code changes. All the other markers also keep their size when you change the distance between the object and the camera.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #27by Cham » 23.09.2006, 15:35

Vincent,

you should submit your transparency code to CVS. And please, a "circle" marker ?

I understand that the arrow offset would need a lot of work on the code. Maybe it's not worth it.

Also, it could be great to add some text as a marker (or maybe in another way), to write few lines here and there floating in space. Something like the Milky Way's arms name (Orion arm, Perseus arm, etc), or just a "you are living there" with a red arrow indicating Earth. I don't want to see (clickable and annoying) billboards floating in space to show some fuzzy and pixelised text.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #28by Vincent » 23.09.2006, 22:40

Cham wrote:Vincent,

you should submit your transparency code to CVS.
Cham, only the official devs can comit a patch to the CVS.

Cham wrote:And please, a "circle" marker ?
Done. :wink:
Image

Cham wrote:Also, it could be great to add some text as a marker (or maybe in another way), to write few lines here and there floating in space. Something like the Milky Way's arms name (Orion arm, Perseus arm, etc), or just a "you are living there" with a red arrow indicating Earth. I don't want to see (clickable and annoying) billboards floating in space to show some fuzzy and pixelised text.

I think that can be done with Hank's fantastic lua hook patch...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #29by Cham » 24.09.2006, 01:00

Vincent wrote:Done. :wink:
Image


Fantastic ! Bubbles in space ! :D

Chris ! Please, add this to CVS !!!
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #30by chris » 24.09.2006, 01:30

Vincent,

If you send me the patches for the marker alpha and the circle markers, I'll commit them to CVS. You really ought to get a propert SourceForge account :)

If you haven't already done so, I recommend making the number of segments in the circle markers depend on the size of the marker. Otherwise, we'll end up with either with polygonal looking circles or drawing a lot of unnecessary lines.

I've been meaning to add names for markers. I think that this is a feature should be built into Celestia rather than done with Lua. Vincent, want to have a go at adding names to markers?

--Chris

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #31by Vincent » 24.09.2006, 14:10

chris wrote:Vincent,

If you send me the patches for the marker alpha and the circle markers, I'll commit them to CVS. You really ought to get a propert SourceForge account :)
OK Chris, here's a zip file including :
- the patch for the marker alpha and the circle markers
- a celestia_markers_test.exe file
- 4 test scripts (2 .cel and 2 .celx)
> http://vincent.gian.club.fr/celestia/ce ... s_test.zip

And I promise I'm going to get a sourceforge account as soon as possible... :roll:

chris wrote:If you haven't already done so, I recommend making the number of segments in the circle markers depend on the size of the marker. Otherwise, we'll end up with either with polygonal looking circles or drawing a lot of unnecessary lines.
OK, that's done. The circle_markers_test.cel script that I've included in the zip file will give you some explanation about the relation between the size and the number of segments...
I've also added a maximum size limit to avoid having a too high number of segments in the circle markers, and a minimum size limit (= 1) since 0 and negative values are not allowed in the case of circle markers.

chris wrote:I've been meaning to add names for markers. I think that this is a feature should be built into Celestia rather than done with Lua. Vincent, want to have a go at adding names to markers?

By "adding names to markers", do you mean "adding a string text as a marker", which is what Cham has suggested ? If that is the case, I may indeed be able to have a go at it... If not, can you please be a little bit more explicit ?
Last edited by Vincent on 24.09.2006, 17:40, edited 1 time in total.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

symaski62
Posts: 610
Joined: 01.05.2004
Age: 41
With us: 20 years 6 months
Location: france, divion

Post #32by symaski62 » 24.09.2006, 15:11

Vincent wrote:
chris wrote:Vincent,

If you send me the patches for the marker alpha and the circle markers, I'll commit them to CVS. You really ought to get a propert SourceForge account :)
OK Chris, here's a zip file including :
- the patch for the marker alpha and the circle markers
- a celestia_markers_test.exe file
- 4 test scripts (2 .cel and 2 .celx)
> http://vincent.gian.club.fr/celestia/ce ... s_test.zip

And I promise I'm going to get a sourceforge account as soon as possible... :roll:

chris wrote:If you haven't already done so, I recommend making the number of segments in the circle markers depend on the size of the marker. Otherwise, we'll end up with either with polygonal looking circles or drawing a lot of unnecessary lines.
OK, that's done. The circle_markers_test.cel script that I've included in the zip file will give you some explanation about the relation between the size and the number of segments...
I've also added a maximum size limit to avoid having a too high number of segments in the circle markers, and a minimum size limit (= 1) since 0 and negative values are not allowed in the case of circle markers.

chris wrote:I've been meaning to add names for markers. I think that this is a feature should be built into Celestia rather than done with Lua. Vincent, want to have a go at adding names to markers?
By "adding names to markers", do you mean "adding a string text as a marker", which is what Cham has suggested ? If that is the case, I may indeed be able to have a go at it... If not, could you please be a little bit more explicit ?


THX 20/20 note
windows 10 directX 12 version
celestia 1.7.0 64 bits
with a general handicap of 80% and it makes much d' efforts for the community and s' expimer, thank you d' to be understanding.


Return to “Development”