Jump to content

tjheldna

Members
  • Posts

    938
  • Joined

  • Last visited

Everything posted by tjheldna

  1. Not sure if this is a bug or suggestion, but I'll put it here. If you select an entity in the scene list the item is lighted in a bright blue color, however if you select an entity in a view port the list's highlight is a light grey. As the list gets bigger, it's becoming increasingly difficult to find that selected entity when selected from the view port in the list. Sometimes I've had to do a couple of passes to locate it. Could this selection scenario be changed to the bright blue color too? Cheers!
  2. Was going to put this in it's own report, but I think this could be an extension of the cloning issue. Prefabs added into the world are being deleted when certain criteria is met and reloading the map. - Drag a prefab into the world - Save the map - Reload the world - Make a change and save the map - Reload the world The prefab will no longer be in the map.... Cheers!
  3. Hi Josh, If you place a prefab in the map CTRL drag copies from that first instance as many times as you like. If you CTRL drag from any one of the copies of the first instance added it will not duplicate. Make sense? Cheers
  4. This will still work for a c++ project in the current version of LE, however in my current build I have made many new changes. I should do an update, little annoying that it's real hard to find on the forums now because it's not a workshop item.
  5. I'm using Shadmar's effect class where the shaders are created via a lua script. I'll take a look at it when I have a minute.
  6. Just tested my project and like you can confirm memory usage does not go down when using ClearPostEffects().
  7. Created a little project to demonstrate the issue. Instructions on what do do are displayed in game... debugSound.rar Cheers!
  8. I'm only posting this due to the fact I have already combed through my code to rule that out. Also this problem coincides with the latest beta update and is in C++. I'm getting a consistent crash when Releasing a texture in code (The Texture is also declared in code too). Have there been any changes to the way textures work within this time? I'm also declaring a second instance of the texture if that makes any difference; Debugging goes somewhere I can't see.... The last thing I can see on the debugger is mipmaps so I've changed the mipmap flag's on textures involved which hasn't helped. Debuging the Texture object: currentmiplevel = -1; Could this be causing the list to be out of range when released? hasmipmaps = false;
  9. Sorry this post was done real quickly. K here is the shader, I created a new one called drawimagecrop.shader instead of modifying... uniform vec4 drawcolor; uniform sampler2D texture0; uniform vec2 scale = vec2(1.0,1.0); //added for tiling uniform vec2 clipcoords = vec2(0.0,0.0); //added for clipping in vec2 vTexCoords0; out vec4 fragData0; void main(void) { fragData0 = drawcolor * texture(texture0, (vTexCoords0 + clipcoords) * scale); } here is my C++ ViewportWidget class // // ViewportWidget.cpp // BCS // // Created by Tim Heldna on 13/03/13. // Copyright (c) 2013 BCS. All rights reserved. // #include "ViewportWidget.h" #include "GameWorld.h" ViewportWidget::ViewportWidget(World *&w, Context *current, short posX, short posY, short width, short height) : Widget(posX, posY, width, height, kWidgetTypeRemoteCamera) { cbuffer = NULL; world = w; context = Context::GetCurrent(); bufferTexture = Texture::Create(current->GetWidth(), current->GetHeight()); cbuffer = Buffer::Create(current->GetWidth(), current->GetHeight(), 1, 0, 0); cbuffer->SetColorTexture(bufferTexture); shader = Shader::Load("Shaders/Drawing/drawimagecrop.shader"); shader->SetVec2("clipcoords", Vec2(0.01, 0.4)); SetFlags(GetFlags() | kWidgetFlagsNoInput); } ViewportWidget::~ViewportWidget() { if(shader)shader->Release(); if(cbuffer)cbuffer->Release(); if (bufferTexture) bufferTexture->Release(); } Widget *ViewportWidget::HandleMouseEvent(Widget *widget) { if (TheGameWorld) { //Render to buffer cbuffer->Enable(); cbuffer->Clear(); Vec3 currPos = TheGameWorld->GetCamera()->GetEntity()->GetPosition(); Vec3 currRot = TheGameWorld->GetCamera()->GetEntity()->GetRotation(); //TheGameWorld->GetCamera()->GetEntity()->SetPosition(pos); //TheGameWorld->GetCamera()->GetEntity()->SetRotation(rot); world->Render(); TheGameWorld->GetCamera()->GetEntity()->SetPosition(currPos); TheGameWorld->GetCamera()->GetEntity()->SetRotation(currRot); cbuffer->Disable(); //Switch back to context and render Context::SetCurrent(context); } return Widget::HandleMouseEvent(widget); } void ViewportWidget::Render() { Widget::Render(); if (bufferTexture) { bufferTexture->clamp[0] = true; bufferTexture->clamp[1] = true; Shader*prevShader = context->GetShader(); context->SetShader(shader); context->DrawImage(bufferTexture, worldPosX, worldPosY, width, height); context->SetShader(prevShader); } } void ViewportWidget::Remove() { Widget::Remove(); } Here is the result Note in the code I'm setting the clamp's if I don't the texture will tile. Also correct me if I'm wrong but is this only clipping this on two sides? Cheers!
  10. What I'm trying to achieve is create a viewport of the character speaking to go along with the dialog displayed. What I have done is create a new buffer which grabs a screen of character speaking. and draw the image next to the characters dialog. What I don't know how to do is to crop the image as I just want to get the center portion which will be of the character's face (at the moment it's displaying the entire screen). Are there any texture functions that will do this or alike? Cheers!
  11. What I am doing is using the memory address as recommended by Josh. entity->GetAddress().
  12. I too have just been having a shadowmap issue...This is a newly imported model tonight. The error 'Failed to set shadowmap' appeares when saving the model in the model viewer and the editor would crash. Took probably about 7 editor restarts before it finally saved. The only thing I did different after a few goes was to generate a texture for it, but I don't know if that was the thing that made the difference. Before the model was textured it was mainly white, but it has a blue and yellow patch and is still visible now it's textured. This weird colouring is not in the texture itself but is present when viewed in the editor and in game. I can provide the model if it helps. Cheers
  13. Haven't tried this out, so let me know if it works. http://www.leadwerks.com/werkspace/topic/9913-drawimage-tiled/
  14. Thanks guys you are right, I was thinking the variable was a Material not a matrix. Kudos to Shadmar for the help too.
  15. I'm just taking a look at Shadmar's Day Night code to recreate it in my C++ project and trying to make sense of this this line, but can't work out where the .k is coming from? I can see where all the others are though self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize() Script.DaySpeedXYZ=Vec3(0.1,0.0,0.0)--Vec3 Script.FollowCamera=true--bool Script.mieDirectionalG=0.8--float Script.mieCoefficient=0.02--float Script.turbidity=4.0--float Script.reileighCoeff=3.0--float Script.luminance=0.7--float Script.yoffset=200.0--float Script.bloomadjust=1.0--float Script.cloudspeed=0.08--float Script.cloudcover=0.6--float Script.cloudthickness=1.0--float Script.cloudheight=0.08--float Script.cloudscale=0.05--float Script.cloudmix=1.0--float Script.cloudcolor=Vec3(.7,.7,.7)--Vec3 Script.bloomvalues=Vec3(0.11,0.158,0.298) function Script:Start() self.mat=Material:Load("Materials/DayNight/daynight.mat") self.shader=self.mat:GetShader() self.world=World:GetCurrent() --load fog shader so we can color the fog. --self.fog=Shader:Load("Shaders/PostEffects/EffectClass/_klepto_fog.shader") end function Script:UpdateWorld() --Day cycle self.entity:Turn(self.DaySpeedXYZ.x*Time:GetSpeed(),self.DaySpeedXYZ.y*Time:GetSpeed(),self.DaySpeedXYZ.z*Time:GetSpeed()) --Get Sun vector light=self.entity self.dir = Vec3(light.mat.k.x,light.mat.k.y,light.mat.k.z):Normalize() --Send sun vector to shader self.shader:SetVec3("sunPos",Vec3(-self.dir.x,-self.dir.y,-self.dir.z)) Cheers
  16. it's more of a light and cheery fog, however you may be after a more ill tempered and menacing fog. Sorry for the CPP fog->SetFogRange(Vec2(20.0F, 140.0F)); fog->SetFogColor(Vec4(0.7, 0.66F, 0.62F, 0.6F));
  17. Yeah Shadmar did a post fog a while back, it's real nice. http://leadwerks.wikidot.com/wiki:snippets-shader
  18. Thanks for that, tonight I'll go through my world and code to see what a difference this will make. I must admit I hadn't paid any attention to making entities static or dynamic for lighting. I'll let you know my results
  19. Hi Josh, I've been struggling with point lights too with my Mages game built in release. In my opening scene there are two point lights visible in the room and shadows on high my fps is barely scraping 30fps on my desktop and on my macbook pro which is around a year old it's less. As soon as I've moved out of range and visibility of the lights the fps shoots back up again. Also if I pan back around to the direction of the lights I get the chock factor too. My video card is getting a little dated but still decent, going by other games I've played it should be able to handle it no worries. I would be willing to let you take a look at my Mages project to see if there is anything you can find however I don't want the project public. Cheers
  20. virtual is very important I'm not too technical on this but it comes into play when you have inherited objects I'll try to use it in a game example: Say I have the base class object with a function tostring() and declared as a virtual function. class baseCamera { virtual string tostring() } now I have a derived classes which overrides the tostring method of the base class. class fpsCamera: public baseCamera { string tostring(); } class tpsCamera: public baseCamera { string tostring(); } Say in my game world I always want to reference the current camera, I would use a baseCamera pointer as I can point to either the fps and tps camera (whichever is the current) class GameWorld { baseCamera *cam; } now I want to call cam->tostring() I don't care if it's tps or fps and I don't want to call the baseCamera's tostring method I want to call the tpsCameras tostring() method or the fpsCamera's tostring() and that's what adding virtual will do for you. It will call the derived classes method first. Hope I explained it good enough
  21. Here is a snippet from my third person camera code, pretty sure I derived it from Aggrors Tut (can't remember). Obviously a lot of the variables are declared somewhere else the section you are after is the Pick. Note you need to set the characters pick mode to 0 else the pick will hit the model and wont work. GetCameraTarget() returns an entity that the camera is tracking Let me know if you have any questions void ChaseCamera::Update(void) { BaseCamera::Update(); if (GetCameraTarget()) { Vec3 lastPosition; Vec3 lastRotation; BaseObject* object = (BaseObject*)GetCameraTarget()->GetUserData(); //Calculate the furthest TPS pivot position tpsPivot->SetPosition(GetCameraTarget()->GetPosition()); Vec3 pickPos = GetCameraTarget()->GetPosition(); pickPos.y += GetHeight(); Vec3 rot = tpsPivot->GetRotation(); Vec3 pos = tpsPivot->GetPosition(); pos.y += GetHeight(); tpsPivot->SetPosition(pos); rot.y = -characterYaw; rot.x = -characterPitch; tpsPivot->SetRotation(rot); entity->Point(tpsPivot); tpsPivot->Move(0.0, GetHeight(), -GetCamDistance(), false); //Use a pick to determine where the camera should be PickInfo pick; GetCameraTarget()->SetPickMode(0); if (World::GetCurrent()->Pick(pickPos, tpsPivot->GetPosition(), pick, 0.0F, true)) tpsPivot->SetPosition(pick.position); GetCameraTarget()->SetPickMode(Entity::SpherePick); //Apply position lastPosition.x = Math::Curve(tpsPivot->GetPosition().x, entity->GetPosition().x, (GetSmoothness()) / Time::GetSpeed()); lastPosition.y = Math::Curve(tpsPivot->GetPosition().y, entity->GetPosition().y, (GetSmoothness()) / Time::GetSpeed()); lastPosition.z = Math::Curve(tpsPivot->GetPosition().z, entity->GetPosition().z, (GetSmoothness()) / Time::GetSpeed()); entity->SetPosition(lastPosition); } }
  22. Hi Josh, Yeah I am using the Curve() function for the camera position, but some of those jitters are too big to smooth out (without making my camera too laggy). I have noticed with vsync on the problem reduces. On the weekend I'll try to put a sample project together to help. I'm still trying to play around with it to see if I can find a cause on my end. Cheers!
×
×
  • Create New...