Code: Select all
byte* pVertex = (byte*)vBuff.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
Any idea why that could be happening?
Code: Select all
byte* pVertex = (byte*)vBuff.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
In the wiki I published a demo code which shows how to query vertices and indices of a ManualObject. So you can see how to do.Blasphemer wrote:I've been trying to get it to work with the ManualObject
Conversion of ManualObjects to a Mesh is only possible when the ManOb has indices.Blasphemer wrote:I have been trying to do:Code: Select all
var manualObject = entry.movable as ManualObject; manualObject.ConvertToMesh("Poo", "General");
Sorry, I have no idea.Blasphemer wrote:Hmm I'm getting the same problem with your code as with the ConvertToMesh():
[...]
is throwing an AccessViolationException.
Code: Select all
VertexElement posEl = moData.vertexData.vertexDeclaration.FindElementBySemantic(VertexElementSemantic.VES_POSITION);
HardwareVertexBufferSharedPtr vBuff = moData.vertexData.vertexBufferBinding.GetBuffer(posEl.Source);
byte* pVertex = (byte*)vBuff.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
It's the most easy way to test my code.Blasphemer wrote:Id be happy to test your stuff but I'm using C# as well, sorry.
Source code - download here//--------------------------------------------------
// Preview code for raycasting on polygon level
// (c) 2011 by Beauty beautyod (at) gmx.de
//
// For usage it needs tiny modifications. There related code I added to file RaycastingToPolygonLevel_helper.cs (quick and dirty copy&paste)
// If you miss something or have questions, just ask.
// An improved version I will publish later.
// Look to this forum topic for news: http://www.ogre3d.org/forums/viewtopic.php?f=1&t=67355
//
// Please report your experience in the forum. (If it works well or causes problems.)
//--------------------------------------------------
If you are a C++ user, you can be the slave who creates the port from C#.
I uploaded it quick and dirty and it doesn't run out of the box.saket wrote:i don't think it's dirty
In most easy case just put the methods of xxx_helper.cs to the main class.saket wrote:must have some namespace declaration
Nice to know that it's useful for somebody.saket wrote:As another side your article will help me a lot ... http://www.ogre3d.org/tikiwiki/Read+raw ... ct+-+MOGRE thanks.
The Mogre API is mostly the same.saket wrote:It's a long time, I left C#
I had seen some comment entitled "Data Grabbing", Indeed that's all i wanted to see again. Since the article is removed, i am unable to say anything but most of the time, code-snippet articles has always something to notice (*completely my prospective view).Nice to know that it's useful for somebody.
For what do you use it?
I think in common cases the programmer still knows the vertices/indices, because ManualObjects are created by the applications code.
I think you are talking about Accessors and Mutators (get/set in C#). As per i know, Accessors are just the method/member function that are used to access the values within object but doesn't modify it, whereas Mutators are just used to modify these instances/objects . These are not bonded with the prefix-string as get/set in C++.(As far as I know, C++ doesn't know properties. At least the Ogre API doesn't have such properties.)
A description I published in an other topic, including pictures.saket wrote:I really have some problem to understand TerrainRayCorrection(,) and i think i need some guidance.
I'm sorry for your problems.Blasphemer wrote:The access violation only occurs with ManualObjects (not entities) and if I debug in DirectX. All is ok if I use OpenGL. I wonder how the ManualObject hardware buffers are defined in Ogre.
Always welcome . Sometimes it's not possible to implement what exactly you think, yes only because of time and I really dn't know when I will lead it ... , so till then I think it's always nice to appreciate good view and work.Thanks for analyzing my code and all your compliments.
Yes, I read it. You had also referenced it in your previous comments.the explanation of Ogre founder Sinbad.
It really looks sweet with images, you had worked a lot for this. A tutorial with visual guidelines will always quite easy to understand concepts for beginner as me. I need one more week-end (comming) to go through it.Details about TerrainRayCorrection(,):
viewtopic.php?p=444900#p444900
All the best for your thesis.I was working for my diploma thesis and now I spend time with my girlfriend.
The code is completely re-written and very different on many places.drwbns wrote: [...] is the only difference that it's written in c#, or are there other differences?
[...] is the plan to rewrite the c++ code for raycasting?
Here his animation bugfix code:broncebeard wrote: Beauty, you have a buggy in your raycast to polygon level code
lets say you have a pose or a morph animation with no skeleton, it doesn't work
i just replaced all the getskeletonverts to getsoftwareverts blah blah, but what you could do is put in a || statement when you check to see if it has any animation
it's not that big of a deal, very few people probably have pose animations without bones that need to raycast to polygon level
well it's just another bool and two conditionals
hold on i'll write it real quick and pastebin it
Beauty, and yes, in your code it seems it wouldn't work on a pose animation without a skeleton as well
Code: Select all
// orginal:
bool useSoftwareBlendingVertices = entity->hasSkeleton();
if (useSoftwareBlendingVertices)
{
entity->_updateAnimation();
}
// Modified:
bool useSoftwareBlendingVerticesSkeletons = entity->hasSkeleton();
bool useSoftwareBlendingVerticesMorph = entity->hasVertexAnimation()
if (useSoftwareBlendingVertices || useSoftwareBlendingVerticesMorph)
{
entity->_updateAnimation();
}
Code: Select all
// orginal:
//When there is animation:
if(useSoftwareBlendingVertices)
vertex_data = submesh->useSharedVertices ? entity->_getSkelAnimVertexData() : entity->getSubEntity(i)->_getSkelAnimVertexData();
else
vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;
// Modified:
if(useSoftwareBlendingVerticesSkeletons)
{
vertex_data = submesh->useSharedVertices ? entity->_getSkelAnimVertexData() : entity->getSubEntity(i)->_getSkelAnimVertexData();
}
else if(useSoftwareBlendingVerticesMorph)
{
vertex_data = submesh->useSharedVertices ? entity->_getSoftwareVertexAnimVertexData() : entity->getSubEntity(i)->_getSoftwareVertexAnimVertexData();
}
else
{
vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;
}
broncebeard wrote: Beauty, when you finish your raycaster let me know, i'll port it to cpp
realazthat wrote: raycasting via gpu buffers on CPU seems a bit hackery to me
and, it scales very bad too; what happens with static geometry?
each ray must go through all tris?sorting the trisBeauty wrote: What would be an alternative to cycling though all polygons for each ray? How to you want to check for intersection when ray origin/direction or scene objects are moving?
(this is for multiple rays only)
and if they are moving, then you need to reindex each frame-queries
The SelectionBuffer wiki page is here:DragonM wrote: Use SelectionBuffer, Beauty. Also in the WIki.
SelectionBuffer works as part of your application sources.
It works just fine with the SDK release.
It has an interceptor that's inserted into Ogre's rendering pipeline at the appropriate place. Ogre is designed to accomodate such interceptors without recompiling.
A half year after development of my code I started to use it in my Mogre application. In general it works fine.Blasphemer wrote:Hmm I'm getting the same problem with your code as with the ConvertToMesh():
is throwing an AccessViolationException.Code: Select all
byte* pVertex = (byte*)vBuff.Lock(HardwareBuffer.LockOptions.HBL_READ_ONLY);
Any idea why that could be happening?
If you want to create an entity from a ManualObject, you have to use indices for your ManualObject.Blasphemer wrote:ConvertToMesh()