Comments in hlms preprocessor

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
bishopnator
Gnome
Posts: 327
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 15

Comments in hlms preprocessor

Post by bishopnator »

Hi, is there a way to write a comment in hlms template, but which doesn't go to the output shader? I would like to write comments there to explain some parts or simply in the long file to write for @end to which section it belongs. But those comments are related to the @xxx syntax and not to the actual shader code. If there is no support, probably the simplest would be to add @comment("message") which would be just skipped (enclosing in "" is not essential but most of the text editors would recognize string and color it with different color.

note: I am aware that we have in Ogre forum also 'Feature request' section, but it seems that it is for Ogre 1.x - if it is for both versions, you can move it there (if it is possible to move a post).

User avatar
Crystal Hammer
Orc
Posts: 405
Joined: Sat Jun 23, 2007 5:16 pm
x 115

Re: Comments in hlms preprocessor

Post by Crystal Hammer »

It is possible like so:

Code: Select all

		@property(0)
			// comment to skip
		@end

BTW, I created an issue, since these result in empty lines in shaders like all failed properties anyway.

User avatar
bishopnator
Gnome
Posts: 327
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 15

Re: Comments in hlms preprocessor

Post by bishopnator »

Interesting. It is then rather possible to write comment like on a single line

Code: Select all

@property(0) Some comment @end
@property(0) "Some comment" @end

It is not even necessary to wrap it .. I just don't like how the code will look like, if I need to comment e.g. end of the section:

Code: Select all

@property(something)
.. a lot of code
@end @property(0) end of 'something' @end

It just doesn't feel right. I would like to comment the ends due to distinguishing multiple @end tags in code like this:

Code: Select all

@property(A)
.. some code
@property(B)
.. further code
@property(C)
.. and something special for C
@end
@end
@end

If the code is spread for more than a single screen, such comments would definitely help ..