Jump to content

  • Log In with Google      Sign In   
  • Create Account


Issue with scissorrectangle


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 belgreth   Members   -  Reputation: 132

Like
0Likes
Like

Posted 27 August 2012 - 06:43 PM

I'm stumped on how to fix this issue.

I draw the map using a scissor rect during spriteBatch and later I draw my paperdoll however the scissor rect for the map is cutting off the paperdoll model somehow. Here's an example of it:

http://imageshack.us...2/scissor1.jpg/

http://imageshack.us...3/scissor2.jpg/

I'm drawing part of the map via:

[source lang="csharp"]sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.None, scissorRS);scissorRect.X = mapElementRect.X;scissorRect.Y = mapElementRect.Y;scissorRect.Width = mapElementRect.Width;scissorRect.Height = mapElementRect.Height;// Make sure rect doesn't go out of bounds of screenif (scissorRect.X + scissorRect.Width > screenWidth - 1) scissorRect.Width = screenWidth - scissorRect.X;if (scissorRect.Y + scissorRect.Height > screenHeight - 1) scissorRect.Height = screenHeight - scissorRect.Y;sb.GraphicsDevice.ScissorRectangle = scissorRect;[/source]


The paperdoll is drawn after the map. I believe it has to do with depth as setting device.DepthStencilState to none draws the model fully but of course it's inside out at that point. However I set depth to none when drawing the map.

Any ideas?


EDIT : Ok I feel silly. After combing my code for the past two hours there was one line when drawing the map outline that was setting DepthStencilState to Default during spritebatch.Begin() that I kept missing. Case closed!

Edited by belgreth, 27 August 2012 - 07:17 PM.


Sponsor:

#2 Juliean   GDNet+   -  Reputation: 2438

Like
0Likes
Like

Posted 27 August 2012 - 06:50 PM

Do you have z-sorting enabled? If so, you have to make sure the z of your model is higher than the z of the map.

#3 belgreth   Members   -  Reputation: 132

Like
0Likes
Like

Posted 27 August 2012 - 07:05 PM

I don't believe so. Isn't that what SpriteSortMode.Deferred means? No z sorting, just draw everything on top of each other in draw call order? Plus I'm not specifying a depth when drawing any element

i.e.
[source lang="csharp"]sb.Draw(mapBiomeColorTexture, mapRect, new Color(1, 1, 1, 0.2f)); [/source]




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS