Jump to content

SpiderPig

Members
  • Posts

    2,295
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. Oh okay, I thought maybe both did the exact same thing. How would I align a matrix to a vector?
  2. Thankyou. But should this code give two different results? auto m = Mat4(); m.MakeDir(Vec3(0.0f, 0.0f, 1.0f), 1); Print("Mat4"); Print(WString(m[0])); Print(WString(m[1])); Print(WString(m[2])); Print(WString(m[3])); Print("Quat"); auto q = m.GetQuaternion(); Print(WString(q)); Print("Euler"); auto r = q.Euler(); Print(WString(r)); Print(""); Print("--------------------------------------------------------------"); Print(""); auto up_pivot = CreatePivot(nullptr); up_pivot->AlignToVector(Vec3(0.0f, 0.0f, 1.0f), 1); m = up_pivot->GetMatrix(); Print("Mat4"); Print(WString(m[0])); Print(WString(m[1])); Print(WString(m[2])); Print(WString(m[3])); Print("Quat"); q = m.GetQuaternion(); Print(WString(q)); Print("Euler"); r = q.Euler(); Print(WString(r)); Console Output. Mat4 1, -0, -0, 0 0, 0, 1, 0 0, 1, 0, 0 0, 0, 0, 1 Quat -0, -0, 0, 0.707107 Euler 0, -0, -0 -------------------------------------------------------------- Mat4 0, 1, -0, 0 0, 0, 1, 0 1, -0, -0, 0 0, 0, 0, 1 Quat -0.5, -0.5, -0.5, 0.5 Euler -0, 90, 90
  3. I'm not positive I'm using it right... but no matter what I do the matrix's rotation (r) is always zero. Where as (i) is correct - Vec3(0,90,90); MakeDir() returns nothing, I checked. auto m = Mat4(); m.MakeDir(Vec3(0,0,1), 1); up_pivot->AlignToVector(Vec3(0,0,1), 1); auto i = up_pivot->GetRotation(); auto r = m.GetRotation();
  4. I'm using this code to align a pivot to the up direction of my player controller. up_pivot->AlignToVector(up_direction, 1); target_quat = target_quat.Slerp(up_pivot->GetQuaternion(), 0.1f); kinematic_joint->SetPose(pos, target_quat); The video below shows it working really well when the forward direction is along the X axis (red arrow in the distance). However when moving back and forth along the z axis player spins 90 degrees to face the (+) X axis when the up vector is something like Vec3(0.0f, 0.0f, 1.0f) or Vec3(0.0f, 0.0f, -1.0f). You can see it at around 25 seconds into the video. I know this is a by product of aligning to a vector, but what I'm wondering is - is there is a way to align to an up vector as well as a forward vector? This way I think my player rotation can be more controlled when the up direction changes as I can track both up and forward vectors with ease. Matrix math perhaps?
  5. You mean like a render hook that displayed the inventory when the capture was ready for the inventory shader to use?
  6. Not really, I want to capture a screen shot before I open my inventory and then use that result as a background for my inventory that will be blurred. Like the window transparent effect in the editor. It won't be real time but that's fine. I'm just worried about spending the time waiting for the capture to be ready as a pixmap and then going through all the conversion and re-upload to the GPU when it's already there.
  7. If I capture a screenshot with framebuffer->Capture(), is there a way I get the result within a shader without first getting it as a pixmap, then converting it to a texture, then giving it to a material? if (window->KeyHit(KEY_SPACE)) framebuffer->Capture(); auto caps = framebuffer->GetCaptures(); for (auto pixmap : caps) { auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; pixmap->Save(path); RunFile(path); } Maybe something like this might be possible? FRAGMENT SHADER if (capture_result_handle != -1){ vec4 capture_color = texture(capture_result_handle, frag_coords) }
  8. I'm not using the default widget system here, I've made my own and rasterize my fonts to a texture. In this screenshot you can clearly see the problem I have. I added a background shader to the font shader. The text only looks good when on dark backgrounds. You can see the right side is much nicer than the left side. Here's my inventory. I'm unsure if this is a font shader issue - a rasterization issue - or simply I need better font colours depending on the background color. Thought I'd ask to see if any one here might have any tips.
  9. So it is. Thanks. It's not in the docs by the way.
  10. That would be good. Something like Texture::RemoveMipMap() maybe? Would also be cool if you didn't have to restart the game for it to take effect. You would probably need access to a list of materials to loop through... maybe. Or maybe the user should add there materials to their own list so they can identify what textures should be changed and what shouldn't be.
  11. SetFileTime() would be nice to have. I want to be able to convert a file to DDS and then set the DDS file to the creation date / time of the source file. That way when I run my converter again it won't re-convert the source file unless it is newer than the already existing converted DDS file.
  12. How do games mange the texture resolution that's used in game? In the options menu you sometimes have the ability to change the texture detail from Low to High. I guess all it's doing is using a different resolution per setting. For example; LOW 512x512 MEDIUM 1024x1024 HIGH 2048x2048 ULTRA 4096x4096 I'm wondering if it's possible for everything to have 4K textures, but maybe on game load / restart you could remove the higher resolution mip-maps via code depending on the setting? Surely they can't have 4 copies of each texture, that'd be an insane hard drive guzzler.
  13. Ah so it needs to be a float then.
  14. Yeah, in one of my projects I made a wrapper for them. I called them CastToScreen and CastToWorld. Naming them to show what they do will help.
  15. Also screen_position should probably be an iVec3 like is returned by window->GetMousePosition(), unless there's a need for it to be Vec3?
  16. This may be silly but I'm constantly forgetting which function does what when it comes to the camera functions Project() & UnProject(). It might be helpful if the first argument of both commands were renamed to "Vec3 &screen_position" & "Vec3 &world_position" respectively. That way it be easy to identify what does what!
  17. Hmm it crashes with an out of memory range error. My class inherits Object so the function is available and compiles. void NotificationManager_UpdateHook(shared_ptr<Engine::Object> source, shared_ptr<Engine::Object> object) { } ... void NotificationManager::Init() { AddHook(HOOKID_UPDATE, NotificationManager_UpdateHook, Self()); }
  18. Yup. It's not working with Steam.
  19. Oh... wait. I don't think my paths are actually pointing to steam. One sec...
  20. I'm using the latest steam version on the dev branch and get the error popup "Invalid function syntax fot hook ID 2". This is my code. void NotificationManager_UpdateHook(shared_ptr<Object> object) { } ... void NotificationManager::Init() { world->AddHook(HOOKID_UPDATE, NotificationManager_UpdateHook, Self()); } Based on the parameters for AddHook() my function syntax looks correct... and HOOKID_RENDER works.
  21. Here's a few videos I've found on how to deal with animated objects in blender. Specifically transforming them to new locations, and scaling an armature with animations. (Like from mixamo) In this video the only thing that needs to be done different for armatures with animation tracks, is instead of going "Ctrl+A->Apply Transformations". Go "Ctrl+A->All Transforms to Deltas". This will scale the keyframes for the animations as well.
×
×
  • Create New...