Imageset coords and my confusing result(s)

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Postby dteviot » Thu Dec 21, 2006 19:12

well, for what it's worth, here's the code I used a couple of days ago.
Note that I use a right edge, not a width.

Code: Select all

          <!-- top edge -->
          <ImageryComponent>
            <Area>
              <Dim type="LeftEdge" >
                <AbsoluteDim value="0" >
                  <DimOperator op="Add">
                    <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedTopLeft" dimension="Width" />
                  </DimOperator>
                </AbsoluteDim>
              </Dim>
              <Dim type="TopEdge" >
                <AbsoluteDim value="0" />
              </Dim>
              <Dim type="RightEdge" >
                <UnifiedDim scale="1" offset="0" type="RightEdge">
                  <DimOperator op="Subtract">
                    <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedTopRight" dimension="Width" />
                  </DimOperator>
                </UnifiedDim>
              </Dim>
              <Dim type="Height" >
                 <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedTop" dimension="Height" />
              </Dim>
            </Area>
            <Image imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedTop" />
            <VertFormat type="Stretched" />
            <HorzFormat type="Tiled" />
          </ImageryComponent>

          <!-- bottom edge -->
          <ImageryComponent>
            <Area>
              <Dim type="LeftEdge" >
                <AbsoluteDim value="0" >
                  <DimOperator op="Add">
                    <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedBottomLeft" dimension="Width" />
                  </DimOperator>
                </AbsoluteDim>
            </Dim>
              <Dim type="TopEdge" >
                <UnifiedDim scale="1" offset="0" type="BottomEdge">
                  <DimOperator op="Subtract">
                    <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedBottom" dimension="Height" />
                  </DimOperator>
                </UnifiedDim>
              </Dim>
              <Dim type="RightEdge" >
                <UnifiedDim scale="1" offset="0" type="RightEdge">
                  <DimOperator op="Subtract">
                    <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedBottomRight" dimension="Width" />
                  </DimOperator>
                </UnifiedDim>
              </Dim>
              <Dim type="Height" >
                <ImageDim imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedBottom" dimension="Height" />
              </Dim>
            </Area>
            <Image imageset="XenoLook/Button_v2" image="XnetSubitemHighlightedBottom" />
            <VertFormat type="Stretched" />
            <HorzFormat type="Tiled" />
          </ImageryComponent>

Habba
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Tue Sep 19, 2006 15:21
Location: Finland
Contact:

Postby Habba » Thu Dec 21, 2006 19:31

Lenny, the problem is that you have confused Width with RightEdge. Use subtract-thing only for RightEdge-value, and just plain ImageDim for Width-value.

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Thu Dec 21, 2006 19:42

Why is that the case? I'm not contesting it, of course, for if that is how it works, that is how it works. But that doesn't make logical sense to me.

Still messing with the bottom and top borders, heh. If I use RightEdge and set an AbsoluteDim, I can see what I expect. So, I am obviously setting the wrong area when using a UnifiedDim. I'll poke it some more :)

Habba
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Tue Sep 19, 2006 15:21
Location: Finland
Contact:

Postby Habba » Thu Dec 21, 2006 19:45

Sorry, posted with bit haste. Here's what I meant:

Your code for Top border:

Code: Select all

<Dim type="Width">
         <UnifiedDim scale="1" Type="RightEdge">
            <DimOperator op="Subtract">
               <ImageDim imageset="WindowsLook" image="TabPaneRight" dimension="Width" />
            </DimOperator>
         </UnifiedDim>
      </Dim>


How it should be:

Code: Select all

<Dim type="RightEdge">
         <UnifiedDim scale="1" Type="RightEdge">
            <DimOperator op="Subtract">
               <ImageDim imageset="WindowsLook" image="TabPaneRight" dimension="Width" />
            </DimOperator>
         </UnifiedDim>
      </Dim>

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Thu Dec 21, 2006 19:48

I found my problem: case sensitivity. I was specifying Type="..." when it should have been type="..."

And indeed, using RightEdge was necessary, of course :)

Evil case sensitivity though :-/

edit: I see their tiling is rather...inefficient somewhere. A one pixel background tiled over an area is quite the killer. Luckily stretched is fine, though since these are just test images, I don't know what the future will hold. Whatever it is, I will just have to make sure that if it is tiled that our tile size is bigger to not kill CEGUI.

User avatar
Taharez
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Mon Mar 07, 2005 19:06
Location: Sweden
Contact:

Postby Taharez » Fri Dec 22, 2006 07:59

LennyH wrote:edit: I see their tiling is rather...inefficient somewhere. A one pixel background tiled over an area is quite the killer. Luckily stretched is fine, though since these are just test images, I don't know what the future will hold. Whatever it is, I will just have to make sure that if it is tiled that our tile size is bigger to not kill CEGUI.

Yes, I believe tiling requires that the rendering code creates a quad for each tile (unless you put each component in its own texture, but I'm not sure if that's supported), so single-pixel tiling backgrounds are probably not the most efficient thing to try :) Stretched on the other hand only needs one quad in the stretched direction, so that would be one quad vs. a few thousand in the 1 pixel example.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Fri Dec 22, 2006 11:48

Taharez wrote:
LennyH wrote:edit: I see their tiling is rather...inefficient somewhere. A one pixel background tiled over an area is quite the killer. Luckily stretched is fine, though since these are just test images, I don't know what the future will hold. Whatever it is, I will just have to make sure that if it is tiled that our tile size is bigger to not kill CEGUI.

Yes, I believe tiling requires that the rendering code creates a quad for each tile (unless you put each component in its own texture, but I'm not sure if that's supported), so single-pixel tiling backgrounds are probably not the most efficient thing to try :) Stretched on the other hand only needs one quad in the stretched direction, so that would be one quad vs. a few thousand in the 1 pixel example.

Hmm i'm just thinking about that, but as i think, tiling is one of the most important cases when it comes to variable size background ... so wouldn't it be a good idea that when a tiled background is loaded, CEGUI creates one texture in memory and draws the tiles into it, then uses that one texture to draw the bg ? so it would only use one quad too ?

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Fri Dec 22, 2006 16:18

Pompei2 wrote:
Taharez wrote:
LennyH wrote:edit: I see their tiling is rather...inefficient somewhere. A one pixel background tiled over an area is quite the killer. Luckily stretched is fine, though since these are just test images, I don't know what the future will hold. Whatever it is, I will just have to make sure that if it is tiled that our tile size is bigger to not kill CEGUI.

Yes, I believe tiling requires that the rendering code creates a quad for each tile (unless you put each component in its own texture, but I'm not sure if that's supported), so single-pixel tiling backgrounds are probably not the most efficient thing to try :) Stretched on the other hand only needs one quad in the stretched direction, so that would be one quad vs. a few thousand in the 1 pixel example.

Hmm i'm just thinking about that, but as i think, tiling is one of the most important cases when it comes to variable size background ... so wouldn't it be a good idea that when a tiled background is loaded, CEGUI creates one texture in memory and draws the tiles into it, then uses that one texture to draw the bg ? so it would only use one quad too ?


That's exactly what I was thinking it should do. I guess it boils down to a memory vs cpu thing, but since this is a GUI who's aim is apparently towards games, I would think saving on the CPU is where it would be - especially when it allows for greater performance of the GUI :D!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests