• Advertisement

Search the Community

Showing results for tags 'C++'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • News

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • GameDev Unboxed

Categories

  • Game Dev Loadout

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Topical
    • Virtual and Augmented Reality
    • News
  • Community
    • GameDev Challenges
    • For Beginners
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams

Blogs

There are no results to display.

There are no results to display.

Marker Groups

  • Members

Developers

Developers


Group


About Me


Website


Industry Role


Twitter


Github


Twitch


Steam

Found 382 results

  1. For those that don't know me. I am the individual who's two videos are listed here under setup for https://wiki.libsdl.org/Tutorials I also run grhmedia.com where I host the projects and code for the tutorials I have online. Recently, I received a notice from youtube they will be implementing their new policy in protecting video content as of which I won't be monetized till I meat there required number of viewers and views each month. Frankly, I'm pretty sick of youtube. I put up a video and someone else learns from it and puts up another video and because of the way youtube does their placement they end up with more views. Even guys that clearly post false information such as one individual who said GLEW 2.0 was broken because he didn't know how to compile it. He in short didn't know how to modify the script he used because he didn't understand make files and how the requirements of the compiler and library changes needed some different flags. At the end of the month when they implement this I will take down the content and host on my own server purely and it will be a paid system and or patreon. I get my videos may be a bit dry, I generally figure people are there to learn how to do something and I rather not waste their time. I used to also help people for free even those coming from the other videos. That won't be the case any more. I used to just take anyone emails and work with them my email is posted on the site. I don't expect to get the required number of subscribers in that time or increased views. Even if I did well it wouldn't take care of each reoccurring month. I figure this is simpler and I don't plan on putting some sort of exorbitant fee for a monthly subscription or the like. I was thinking on the lines of a few dollars 1,2, and 3 and the larger subscription gets you assistance with the content in the tutorials if needed that month. Maybe another fee if it is related but not directly in the content. The fees would serve to cut down on the number of people who ask for help and maybe encourage some of the people to actually pay attention to what is said rather than do their own thing. That actually turns out to be 90% of the issues. I spent 6 hours helping one individual last week I must have asked him 20 times did you do exactly like I said in the video even pointed directly to the section. When he finally sent me a copy of the what he entered I knew then and there he had not. I circled it and I pointed out that wasn't what I said to do in the video. I didn't tell him what was wrong and how I knew that way he would go back and actually follow what it said to do. He then reported it worked. Yea, no kidding following directions works. But hey isn't alone and well its part of the learning process. So the point of this isn't to be a gripe session. I'm just looking for a bit of feed back. Do you think the fees are unreasonable? Should I keep the youtube channel and do just the fees with patreon or do you think locking the content to my site and require a subscription is an idea. I'm just looking at the fact it is unrealistic to think youtube/google will actually get stuff right or that youtube viewers will actually bother to start looking for more accurate videos.
  2. Hi, can someone please explain why this is giving an assertion EyePosition!=0 exception? _lightBufferVS->viewMatrix = DirectX::XMMatrixLookAtLH(XMLoadFloat3(&_lightBufferVS->position), XMLoadFloat3(&_lookAt), XMLoadFloat3(&up)); It looks like DirectX doesnt want the 2nd parameter to be a zero vector in the assertion, but I passed in a zero vector with this exact same code in another program and it ran just fine. (Here is the version of the code that worked - note XMLoadFloat3(&m_lookAt) parameter value is (0,0,0) at runtime - I debugged it - but it throws no exceptions. m_viewMatrix = DirectX::XMMatrixLookAtLH(XMLoadFloat3(&m_position), XMLoadFloat3(&m_lookAt), XMLoadFloat3(&up)); Here is the repo for the broken code (See LightClass) https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/LightClass.cpp and here is the repo with the alternative version of the code that is working with a value of (0,0,0) for the second parameter. https://github.com/mister51213/DX11Port_SoftShadows/blob/master/Engine/lightclass.cpp
  3. Hi, I am sending data to peers and those data need to be retreived from a scenegraph with a mutex to lock the data. The process of gathering the data is taking a bit less than a ms. I'm starting the thread every time I want to gather the data. If I'm running at 60 fps, I'm starting the thread 60 times per second so is that a performance or design problem? Would it be much better to have the thread always running and some kind of mechanism to ask him to perform the task whenever it's needed, so around 60 or 120fps? Also, does starting a thread creates some memory alloc/dealloc and then produce on the long run some kind of fragmentation? Thank you all.
  4. Hello! I wrote a simple bones system that renders a 3D model with bones using software vertex processing. The model is loaded perfectly, but I can't see any colors on it. For illustration, you can see the 3D lines list, the bones ( 32 bones ) are in correct position ( bind pose ). Now, here's the problem. When I try to render the mesh with transformations applied then I see this: As you can see the 3D lines are disappearing, I'm guessing the model is rendered, but the colors are not visible for whatever reason. I tried moving my camera around the line list, but all I can see is some lines disappearing due to the black color of vertices? I'm not loading any textures, am I suppose to load them? However, if I render the vertices without applying ANY bone transformations, then I can see it, but it's a mess, obviously. If you're wondering why it's red, I have set color of these vertices ( only half of them ) to red and the rest half is white. First of all, my apologies for the messy code, but here it is: I'm not sure if vertices are suppose to have weights in them for software vertex processing. I'm storing them in a container, so you don't see them here. #define CUSTOMFVF ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE ) struct CUSTOMVERTEX { D3DXVECTOR3 Position; D3DXVECTOR3 Normal; DWORD Color; }; This is how I store the vertices in container and give them red and white color: This is how I create the device: For every frame: This is the UpdateSkinnedMesh method: I have debugged bone weights and bone indices. They are okay. Bone weights add up to 1.0f, so I'm really wondering why I can't see the model with colors on it?
  5. Hi, can somebody please tell me in clear simple steps how to debug and step through an hlsl shader file? I already did Debug > Start Graphics Debugging > then captured some frames from Visual Studio and double clicked on the frame to open it, but no idea where to go from there. I've been searching for hours and there's no information on this, not even on the Microsoft Website! They say "open the Graphics Pixel History window" but there is no such window! Then they say, in the "Pipeline Stages choose Start Debugging" but the Start Debugging option is nowhere to be found in the whole interface. Also, how do I even open the hlsl file that I want to set a break point in from inside the Graphics Debugger? All I want to do is set a break point in a specific hlsl file, step thru it, and see the data, but this is so unbelievably complicated and Microsoft's instructions are horrible! Somebody please, please help.
  6. I'm working a lot with identifiers types to help me while debugging or managing collections of instances in my code. Previously, I had using directives as the following example code: using AnimalId = unsigned int; using TreeId = unsigned int; After a while, I accidentally mixed AnimalId and TreeId in my logic, so I've decided to use structs in order to make the identifiers strong typed. To avoid code duplications, I've created a template template <typename TypeTag, typename ValueType> struct IdType { ValueType value; // Methods for comparison and hashes }; However, I believe there's two different ways of using this template: // Using directive struct AnimalIdTag {} using AnimalId = IdType<AnimalIdTag, unsigned int>; // Inheritance struct TreeId : IdType<TreeId, unsigned int>; And here is where I got in doubt. It seems both ways are valid, but there should be some differences. For example, with inheritance I can forward declare the TreeId on headers, which doesn't seem really feasible (in a painless way) with AnimalId. However, TreeId uses inheritance, and my knowledge on how inheritance and templates works "in background" is too weak to say, but it feels like there might be some hidden drawback. Are there differences to make deciding which one to use easier? Or there's currently no drawbacks (besides being able to forward declare or not)?
  7. Hello everyone. Me and a bunch of classmates are making a videogame from scratch in c++. We are currently using the Irrlicht Engine in our code, but will begin to develop our own engine in a couple of weeks. One of our concerns right now is the User Interface. After doing some research, I found several libraries for creating a GUI in c++, problem is in the past we have spent more time learning and figuring out how to make things work with libraries than we would have if we actually made the entire code from scratch ourselves. So, I wanted to ask more experienced game programmers out there, what would be your preferred choice? using a library or writting the code from scratch when making an UI, and in case of the libraries, which ones would you use?. Heres what we will most likely do: Healthbars Displaying numbers in HUD Displaying icons (images) in HUD Drawing game menu elements (text and rectangles) Also, we are currently working in linux, more specifically Manjaro KDE and without IDE's (using our own make file and the console). PD: Sorry in advance is this is in the wrong topic, It's my first time asking a question in GameDev.net
  8. Mie Scattering

    I implemented the paper, Numerical Methods for Mie Theory of Scattering by a Sphere, Link:https://prints.iiap.res.in/bitstream/2248/72/1/Numerical Methods for Mie Theory of Scattering by a Sphere.pdf Unfortunately, my implementation is not accurate. I couldn't find any mistakes in my code. Can anyone help me? struct XMDOUBLE2 { double x; double y; XMDOUBLE2() {} XMDOUBLE2(double _x, double _y) : x(_x), y(_y) {} explicit XMDOUBLE2(_In_reads_(2) const double *pArray) : x(pArray[0]), y(pArray[1]) {} XMDOUBLE2& operator= (const XMFLOAT2& Float2) { x = Float2.x; y = Float2.y; return *this; } }; XMDOUBLE2 Complex_Add(XMDOUBLE2 z1, XMDOUBLE2 z2)// z1 + z2 { return XMDOUBLE2((z1.x + z2.x), (z1.y + z2.y)); } XMDOUBLE2 Complex_Subtract(XMDOUBLE2 z1, XMDOUBLE2 z2)// z1 - z2 { return XMDOUBLE2((z1.x - z2.x), (z1.y - z2.y)); } XMDOUBLE2 Complex_Multiply(XMDOUBLE2 z1, XMDOUBLE2 z2)// z1*z2 { return XMDOUBLE2(((z1.x*z2.x) - (z1.y*z2.y)), ((z1.x*z2.y) + (z1.y*z2.x))); } double Complex_Norm(XMDOUBLE2 z)// |z| { return sqrt((z.x*z.x) + (z.y*z.y)); } XMDOUBLE2 Complex_Division(XMDOUBLE2 z1, XMDOUBLE2 z2)// z1/z2 { XMDOUBLE2 tmp; if (Complex_Norm(z2) != 0) { tmp.x = ((z1.x*z2.x)+(z1.y*z2.y))/((z2.x*z2.x)+(z2.y*z2.y)); tmp.y = ((z1.y*z2.x)-(z1.x*z2.y))/((z2.x*z2.x)+(z2.y*z2.y)); } return tmp; } //m = 1.5+i0.0 void MieCoefficient(XMDOUBLE2 m, float r, float Lamda)//m = (m')+i(-m"): complex index of refraction, r: radius of the spherical particle in um, lamda: wavelength in nm { #define TOTAL_MAX_TERMS 2100 double Alpha[TOTAL_MAX_TERMS], Beta[TOTAL_MAX_TERMS], P[TOTAL_MAX_TERMS], Q[TOTAL_MAX_TERMS], R[TOTAL_MAX_TERMS], S[TOTAL_MAX_TERMS], B[TOTAL_MAX_TERMS], C[TOTAL_MAX_TERMS], C_[TOTAL_MAX_TERMS]; XMDOUBLE2 A[TOTAL_MAX_TERMS], G[TOTAL_MAX_TERMS], H[TOTAL_MAX_TERMS], a[TOTAL_MAX_TERMS], b[TOTAL_MAX_TERMS]; for (int n=0; n<TOTAL_MAX_TERMS; n++) { Alpha[n] = 0; Beta[n] = 0; P[n] = 0; Q[n] = 0; R[n] = 0; S[n] = 0; B[n] = 0; C[n] = 0; C_[n] = 0; A[n] = XMDOUBLE2(0, 0); G[n] = XMDOUBLE2(0, 0); H[n] = XMDOUBLE2(0, 0); a[n] = XMDOUBLE2(0, 0); b[n] = XMDOUBLE2(0, 0); } // float Lamdaum = (float)Lamda*1e-3; float x = 23.1f;//((2*XM_PI*r) / Lamdaum); //int MAX_TERMS = (int)(x + 7.5f*pow(x, .34f) + 2); int MAX_TERMS = (int)(x + 4*pow(x, 0.33f) + 2); //Wiscombe if (MAX_TERMS<TOTAL_MAX_TERMS) { double y1 = x*m.x; double y2 = x*m.y; XMDOUBLE2 z = XMDOUBLE2(y1, y2); double zNorm = Complex_Norm(z); double y = zNorm*zNorm; for (int n=MAX_TERMS; n>0; n--) { Alpha[n] = ((((2*(double)(n))-1)*y1) / y) - P[n]; Beta[n] = ((((2*(double)(n))-1)*y2) / y) + Q[n]; P[n-1] = (Alpha[n] / ((Alpha[n]*Alpha[n]) + (Beta[n]*Beta[n]))); Q[n-1] = (Beta[n] / ((Alpha[n]*Alpha[n]) + (Beta[n]*Beta[n]))); R[n-1] = (x / (((2*(double)(n))-1) - (x*R[n]))); } S[0] = sin(x); for (int n=1; n<MAX_TERMS; n++) { S[n] = R[n]*S[n-1]; } for (int n=0; n<MAX_TERMS; n++) { XMDOUBLE2 t1 = Complex_Division(XMDOUBLE2(1.0f, 0), XMDOUBLE2(P[n], Q[n])); XMDOUBLE2 t2 = Complex_Division(XMDOUBLE2((double)(n), 0), z); A[n] = Complex_Subtract(t1, t2); B[n] = (((1/R[n]) - ((double)(n)/x))); } C[0] = cos(x); C[1] = ((cos(x)/x) + sin(x)); for (int n=2; n<MAX_TERMS; n++) { C[n] = (((((2*(double)(n))-1) / x) * C[n-1]) - C[n-2]); } C_[0] = 0; for (int n=1; n<MAX_TERMS; n++) { C_[n] = (((((double)(-n)) / x) * C[n]) - C[n-1]); } for (int n=0; n<MAX_TERMS; n++) { G[n] = XMDOUBLE2(1, (C[n]/S[n])); H[n] = XMDOUBLE2(B[n], (C_[n]/S[n])); } for (int n=0; n<MAX_TERMS; n++) { XMDOUBLE2 t1 = Complex_Multiply(m, XMDOUBLE2(B[n], 0)); XMDOUBLE2 t2 = Complex_Multiply(A[n], G[n]); XMDOUBLE2 t3 = Complex_Multiply(m, H[n]); a[n] = Complex_Division(Complex_Subtract(A[n], t1), Complex_Subtract(t2, t3)); XMDOUBLE2 t4 = Complex_Multiply(m, A[n]); XMDOUBLE2 t5 = Complex_Multiply(t4, G[n]); b[n] = Complex_Division(Complex_Subtract(t4, XMDOUBLE2(B[n], 0)), Complex_Subtract(t5, H[n])); } double Qext = 0, tmp = 0; for (int n=0; n<MAX_TERMS; n++) { tmp += (((2*(double)(n))+1) * Complex_Add(a[n], b[n]).x); } Qext = ((tmp*2) / (x*x)); char s[256]; sprintf_s(s, "%.25f", Qext); MessageBoxA(0, s, "", MB_OK); } }
  9. I finally ported Rastertek's tutorial # 42 on soft shadows and blur shading. This tutorial has a ton of really useful effects and there's no working version anywhere online. Unfortunately it just draws a black screen. Not sure what's causing it. I'm guessing the camera or ortho matrix transforms are wrong, light directions, or maybe texture resources not being properly initialized. I didnt change any of the variables though, only upgraded all types and functions DirectX3DVector3 to XMFLOAT3, and used DirectXTK for texture loading. If anyone is willing to take a look at what might be causing the black screen, maybe something pops out to you, let me know, thanks. https://github.com/mister51213/DX11Port_SoftShadows Also, for reference, here's tutorial #40 which has normal shadows but no blur, which I also ported, and it works perfectly. https://github.com/mister51213/DX11Port_ShadowMapping
  10. Im using micropather, a c++ implementation of a* pathfinding in my games. I got it to work fine with a strict grid-based system, but now need it to also work with "nodes". My setup is like this: 1. I have a collection of nodes. Each node has a X/Y-position, an ID, and an array of max 10 node-ids it can move to ("adjacent nodes"). 2. Which nodes are reachable from each node are checked (based on a max distance and not having any obstacles between them). 3. Cost to move from a node to another is simply the distance between the 2 nodes' positions. I guess some things will be silimar to how a grid works, but im not sure how to reconstruct the code.
  11. We are pleased to announce the release of Matali Physics 4.0, the fourth major version of Matali Physics engine. What is Matali Physics? Matali Physics is an advanced, multi-platform, high-performance 3d physics engine intended for games, virtual reality and physics-based simulations. Matali Physics and add-ons form physics environment which provides complex physical simulation and physics-based modeling of objects both real and imagined. The engine is available across multiple platforms: Android *BSD iOS Linux OS X SteamOS Windows 10 UAP/UWP Windows 7/8/8.1/10 Windows XP/Vista What's new in version 4.0? One extended edition of Matali Physics engine Support for Android 8.0 Oreo, iOS 11.x and macOS High Sierra (version 10.13.x) as well as support for the latest IDEs Matali Render 3.0 add-on with physically-based rendering (PBR), screen space ambient occlusion (SSAO) and support for Vulkan API Matali Games add-on Main benefits of using Matali Physics: Stable, high-performance solution supplied together with the rich set of add-ons for all major mobile and desktop platforms (both 32 and 64 bit) Advanced samples ready to use in your own games New features on request Dedicated technical support Regular updates and fixes The engine history in a nutshell Matali Physics was built in 2009 as a dedicated solution for XNA. The first complete version of the engine was released in November 2010, and it was further developed to July 2014 forming multi-platform, fully manage solution for .NET and Mono. In the meantime, from October 2013 to July 2014, was introduced simultaneous support for C++. A significant change occurred in July 2014 together with the release of version 3.0. Managed version of the engine has been abandoned, and the engine was released solely with a new native core written entirely in modern C++. Currently the engine is intensively developed as an advanced, cross-platform, high-performance 3d physics solution. If you have questions related to the latest update or use of Matali Physics engine as a stable physics solution in your projects, please don't hesitate to contact us.
  12. We are pleased to announce the release of Matali Physics 4.0, the fourth major version of Matali Physics engine. What is Matali Physics? Matali Physics is an advanced, multi-platform, high-performance 3d physics engine intended for games, virtual reality and physics-based simulations. Matali Physics and add-ons form physics environment which provides complex physical simulation and physics-based modeling of objects both real and imagined. The engine is available across multiple platforms: Android *BSD iOS Linux OS X SteamOS Windows 10 UAP/UWP Windows 7/8/8.1/10 Windows XP/Vista What's new in version 4.0? One extended edition of Matali Physics engine Support for Android 8.0 Oreo, iOS 11.x and macOS High Sierra (version 10.13.x) as well as support for the latest IDEs Matali Render 3.0 add-on with physically-based rendering (PBR), screen space ambient occlusion (SSAO) and support for Vulkan API Matali Games add-on Main benefits of using Matali Physics: Stable, high-performance solution supplied together with the rich set of add-ons for all major mobile and desktop platforms (both 32 and 64 bit) Advanced samples ready to use in your own games New features on request Dedicated technical support Regular updates and fixes The engine history in a nutshell Matali Physics was built in 2009 as a dedicated solution for XNA. The first complete version of the engine was released in November 2010, and it was further developed to July 2014 forming multi-platform, fully manage solution for .NET and Mono. In the meantime, from October 2013 to July 2014, was introduced simultaneous support for C++. A significant change occurred in July 2014 together with the release of version 3.0. Managed version of the engine has been abandoned, and the engine was released solely with a new native core written entirely in modern C++. Currently the engine is intensively developed as an advanced, cross-platform, high-performance 3d physics solution. If you have questions related to the latest update or use of Matali Physics engine as a stable physics solution in your projects, please don't hesitate to contact us. View full story
  13. Hey guys, I'm using OpenAL for long time ago and I realized if you apply an effect to a audio source and then you apply another one to another audio source then the effect of both will change to the latest one, is this normal? I think it's a pretty stupid question to be honest but after some search through internet I couldn't get a clear answer. As far as I know, audio effects are handled by current listener zone (I'm not sure about this). Can anyone confirm that statement is right? Thanks in advance.
  14. Greetings! Who do I need? I am creating a game and I need a 2D Pixel Artist(s) for my game. Introduction: I created a game company two days ago called Dark Star Ship Studio (The link to the company: http://darkstarshipstudio.com/). The game I am creating is a 2D action RPG game with city building game play elements and world exploration game play elements. The world is a procedural generated map (its in the design process) and I am creating the game play; unfortunately, my art skills are very poor. How much work did I accomplished? I've been working on my home brew game engine in C++ and I did try to make some pixel art (I attached a image example). Again, I know my pixel art is horrible. I do not have the talent or patience to create visual art. In addition, I did try to learn on how to create a decent pixel sprite sheet; however, I lost my patience and decided to come here to seek talented artists that are looking for an opportunity. What's in it for you? I wish I can compensate for your services and help. I am in the process of adding more Software Design plans for the game engine and hopefully the game can be available in mobile devices. As a matter of fact, I did registered for the Nintendo Developer Portal and I do wish to release the game in the Nintendo 3DS or Nintendo Switch (I know what you're thinking, "This guy is nuts!"). I cannot promise if the product will succeed or not; however, the reward of creating a game and gaining experience can be very helpful in the future. Thank you for your time! cyberspace009
  15. Hi Guys, Just wondering if it is possible to get the window handle of another open application given it's window title? The reasoning behind this is I am making an external editor for an IDE and want to inject an 'F5' to force the external IDE to make a build. The IDE doe not have any external way to trigger a build (GameMaker Studio). Any advice would be awesome. Thanks in advance.
  16. Hi heading is float alike 12.3524423 std::string sheading = std::to_string(heading); now I only want to display 12.35 Many thanks in advance
  17. I made a spotlight that 1. Projects 3d models onto a render target from each light POV to simulate shadows 2. Cuts a circle out of the square of light that has been projected onto the render target as a result of the light frustum, then only lights up the pixels inside that circle (except the shadowed parts of course), so you dont see the square edges of the projected frustum. After doing an if check to see if the dot product of light direction and light to vertex vector is greater than .95 to get my initial cutoff, I then multiply the light intensity value inside the resulting circle by the same dot product value, which should range between .95 and 1.0. This should give the light inside that circle a falloff from 100% lit to 0% lit toward the edge of the circle. However, there is no falloff. It's just all equally lit inside the circle. Why on earth, I have no idea. If someone could take a gander and let me know, please help, thank you so much. float CalculateSpotLightIntensity( float3 LightPos_VertexSpace, float3 LightDirection_WS, float3 SurfaceNormal_WS) { //float3 lightToVertex = normalize(SurfacePosition - LightPos_VertexSpace); float3 lightToVertex_WS = -LightPos_VertexSpace; float dotProduct = saturate(dot(normalize(lightToVertex_WS), normalize(LightDirection_WS))); // METALLIC EFFECT (deactivate for now) float metalEffect = saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace))); if(dotProduct > .95 /*&& metalEffect > .55*/) { return saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace))); //return saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace))) * dotProduct; //return dotProduct; } else { return 0; } } float4 LightPixelShader(PixelInputType input) : SV_TARGET { float2 projectTexCoord; float depthValue; float lightDepthValue; float4 textureColor; // Set the bias value for fixing the floating point precision issues. float bias = 0.001f; // Set the default output color to the ambient light value for all pixels. float4 lightColor = cb_ambientColor; /////////////////// NORMAL MAPPING ////////////////// float4 bumpMap = shaderTextures[4].Sample(SampleType, input.tex); // Expand the range of the normal value from (0, +1) to (-1, +1). bumpMap = (bumpMap * 2.0f) - 1.0f; // Change the COORDINATE BASIS of the normal into the space represented by basis vectors tangent, binormal, and normal! float3 bumpNormal = normalize((bumpMap.x * input.tangent) + (bumpMap.y * input.binormal) + (bumpMap.z * input.normal)); //////////////// LIGHT LOOP //////////////// for(int i = 0; i < NUM_LIGHTS; ++i) { // Calculate the projected texture coordinates. projectTexCoord.x = input.vertex_ProjLightSpace[i].x / input.vertex_ProjLightSpace[i].w / 2.0f + 0.5f; projectTexCoord.y = -input.vertex_ProjLightSpace[i].y / input.vertex_ProjLightSpace[i].w / 2.0f + 0.5f; if((saturate(projectTexCoord.x) == projectTexCoord.x) && (saturate(projectTexCoord.y) == projectTexCoord.y)) { // Sample the shadow map depth value from the depth texture using the sampler at the projected texture coordinate location. depthValue = shaderTextures[6 + i].Sample(SampleTypeClamp, projectTexCoord).r; // Calculate the depth of the light. lightDepthValue = input.vertex_ProjLightSpace[i].z / input.vertex_ProjLightSpace[i].w; // Subtract the bias from the lightDepthValue. lightDepthValue = lightDepthValue - bias; float lightVisibility = shaderTextures[6 + i].SampleCmp(SampleTypeComp, projectTexCoord, lightDepthValue ); // Compare the depth of the shadow map value and the depth of the light to determine whether to shadow or to light this pixel. // If the light is in front of the object then light the pixel, if not then shadow this pixel since an object (occluder) is casting a shadow on it. if(lightDepthValue < depthValue) { // Calculate the amount of light on this pixel. float lightIntensity = saturate(dot(bumpNormal, normalize(input.lightPos_LS[i]))); if(lightIntensity > 0.0f) { // Determine the final diffuse color based on the diffuse color and the amount of light intensity. float spotLightIntensity = CalculateSpotLightIntensity( input.lightPos_LS[i], // NOTE - this is NOT NORMALIZED!!! cb_lights[i].lightDirection, bumpNormal/*input.normal*/); lightColor += cb_lights[i].diffuseColor*spotLightIntensity* .18f; // spotlight //lightColor += cb_lights[i].diffuseColor*lightIntensity* .2f; // square light } } } } // Saturate the final light color. lightColor = saturate(lightColor); // lightColor = saturate( CalculateNormalMapIntensity(input, lightColor, cb_lights[0].lightDirection)); // TEXTURE ANIMATION - Sample pixel color from texture at this texture coordinate location. input.tex.x += textureTranslation; // BLENDING float4 color1 = shaderTextures[0].Sample(SampleTypeWrap, input.tex); float4 color2 = shaderTextures[1].Sample(SampleTypeWrap, input.tex); float4 alphaValue = shaderTextures[3].Sample(SampleTypeWrap, input.tex); textureColor = saturate((alphaValue * color1) + ((1.0f - alphaValue) * color2)); // Combine the light and texture color. float4 finalColor = lightColor * textureColor; /////// TRANSPARENCY ///////// //finalColor.a = 0.2f; return finalColor; } Light_vs.hlsl Light_ps.hlsl
  18. Hi Im using binary files to save and load savegames. But when you list your savegames for the user you want some metadata such as date/time, gameday, difficulty, map name etc so the user more easily can identify which savegame they want to load. What is the prefered way of doing it? 1. When saving, save metadata first in the file. Then do a function "scanSaveFiles()" before showing the available savefiles for the user. This will read each "header" of each file (reads the first section of the binary file without actually loading that game) and can then show the info to the user. 2. When saving, update a table of savegame-metadata held by the "gameMaster" that holds other stuff like user options, progress etc. However this seems bad since if the user manually moves or modifies the savefiles the table of savegame-metadata will no longer sync with the actual save files. Or any other smarter way of doing it?
  19. Camera on Vehicle

    I want to attach a camera on a vehicle like so that it will be in the cockpit of the car. I tried messing around with the target position of the view camera. I know there is a current position and target in a view matrix. So I multiplied x and z components of target(view matrix) by 100 to give farther viewing capabilities. This did not work so I was wondering how to attach a a view camera to a vehicle. I just need a general idea on how to do it. | / | / | / CurrentPosition --*100--->target position View Matrix thank you
  20. I make DXGI adapters and monitors enumeration. The second monitor connected to my computer is Dell P2715Q, which has 3840*2160 resolution. However, the program reports it as 2560*1440, the second available resolution. Minimal code to reproduce: #include "stdafx.h" #include <Windows.h> #include <stdio.h> #include <tchar.h> #include <iostream> #include <DXGI.h> #pragma comment(lib, "DXGI.lib") using namespace std; int main() { IDXGIFactory1* pFactory1; HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory1)); if (FAILED(hr)) { wcout << L"CreateDXGIFactory1 failed. " << endl; return 0; } for (UINT i = 0;; i++) { IDXGIAdapter1* pAdapter1 = nullptr; hr = pFactory1->EnumAdapters1(i, &pAdapter1); if (hr == DXGI_ERROR_NOT_FOUND) { // no more adapters break; } if (FAILED(hr)) { wcout << L"EnumAdapters1 failed. " << endl; return 0; } DXGI_ADAPTER_DESC1 desc; hr = pAdapter1->GetDesc1(&desc); if (FAILED(hr)) { wcout << L"GetDesc1 failed. " << endl; return 0; } wcout << L"Adapter: " << desc.Description << endl; for (UINT j = 0;; j++) { IDXGIOutput *pOutput = nullptr; HRESULT hr = pAdapter1->EnumOutputs(j, &pOutput); if (hr == DXGI_ERROR_NOT_FOUND) { // no more outputs break; } if (FAILED(hr)) { wcout << L"EnumOutputs failed. " << endl; return 0; } DXGI_OUTPUT_DESC desc; hr = pOutput->GetDesc(&desc); if (FAILED(hr)) { wcout << L"GetDesc1 failed. " << endl; return 0; } wcout << L" Output: " << desc.DeviceName << L" (" << desc.DesktopCoordinates.left << L"," << desc.DesktopCoordinates.top << L")-(" << (desc.DesktopCoordinates.right - desc.DesktopCoordinates.left) << L"," << (desc.DesktopCoordinates.bottom - desc.DesktopCoordinates.top) << L")" << endl; } } return 0; } Program output: Adapter: Intel(R) Iris(TM) Pro Graphics 6200 Output: \\.\DISPLAY1 (0,0)-(1920,1200) Output: \\.\DISPLAY2 (1920,0)-(2560,1440) DISPLAY2 is reported with low resolution. Environment: Windows 10 x64 Intel(R) Iris(TM) Pro Graphics 6200 DELL P2715Q What can cause this behavior: DirectX restrictions, video memory, display adapter, driver, monitor? How can I fix this and get full available resolution?
  21. Hello, any ideas on how to link statically libfreetype? Ubuntu but later mac and windows. /usr/bin/ld: ./libfreetype.a(ftsystem.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC Thanks
  22. In hopefully the first blog of a (fairly!) regular series I would like to introduce the game I've been working on for a while now. With a working title of COG, the game is a 3D action adventure game with a Steampunk theme and strong platformer elements. This is very much an indie project ... the coding of the home grown engine is done by me, the 3D modeling is (largely) done by me, the level design is done by me and ... well you get the idea! About the only support I'm getting is from my kids who are doing the 'QA' (and who are super critical when something doesn't work!). So where am I with this project? The game engine itself is pretty much 'feature complete' and the game playable even if there is still a lot to do in optimising and polishing the different components. Most of the standard platformer elements (conveyor belts, lifts, moving platforms, spike traps, switches, etc, etc) are already working and available through the level editor with the 'levels' (more accurately map sections) loading on the fly to create a continuous, seamless world. Basic monster code is already in place with it being pretty easy to add new monster types as needed for the game. The lighting and particle systems are currently being reintegrated into the game (the code is complete, but was deactivated while creating the first builds) so hopefully the landscape will soon be full of splashing water and rising steam and smoke (pretty important to have rising steam in a steampunk game!). The camera system is nearing completion - it allows the player to have full control of the angle of the camera with objects close to the camera position fading out to improve player visibility (this is the last bit being worked on here with the drawing order of semi-transparent buildings being tightened up and optimised). Looking at the content there is currently some placeholder content being used with the worst offender being the player's character which is currently a (not very steampunk) Kiwi rather than what will eventually be a small robot. In addition, while the 3D models are almost all self created, the textures used are a mix of those I've created myself, that I've purchased and a handful of temporary placeholder textures. These placeholders have allowed for rapid prototyping (especially as creating textures is a slow and painful process for me), but will obviously need to be replaced in the near future. Fortunately this shouldn't be a huge task as I'm using texture atlases that allow for easy swapping in and out of new textures ... there should be relatively few cases where it may be necessary to tweak the texture mapping. For information the screenshots and video contain this placeholder content. As a result of all this there is now quite a nice library of 'Lego bricks' available including a range of basic building blocks (platforms, towers, walls, pipes, etc), more exotic props (the already mentioned spike traps, barriers, lifts and switches as wells as the mandatory barrels and movable crates), plants, rocks and other landscape elements. Finally, there is a series of animated models including waterwheels, steam engine, pistons and so on whose clanking and whirring will helpful give the impression of a living world around the player. So things are going pretty well at the moment (especially given the limits on the time I can devote to this) and COG seems to be getting to a stage where it is moving from a process of writing code to one where the current task is to complete the game - a pretty rare thing for me! Please let me know you think of the screenshots and video - one of the main reasons for starting this blog is to start getting some feedback to help shape the remainder of the game ... all constructive comments would be very much appreciated. Also if there is interest in a particular aspect of the game development process I would be happy to share more details in a later blog entry. Thank you for your time!
  23. Hi I want to use: https://github.com/PhilippMuenzel/PPL/blob/master/src/fontmgr.h but don't know how to get a FontHandle. For now I do in appinitialization: using namespace MichaelNS; FontMgr m; m.loadFont("./Ubuntu-B.ttf", NULL, NULL, 16, 0); then later how to show a text? I need to replace this: /* Finally we draw the text into the window, also using XPLMGraphics * routines. The NULL indicates no word wrapping. */ XPLMDrawString(color, left + 5, top - 20, (char*)(gClicked ? "I'm a plugin" : "Hello world"), NULL, xplmFont_Basic); with something alike: m.drawString(howtogetthis, #ffffff, 100, 100, align, Hello World); Many thanks in advance and regards
  24. Just realized maybe this doesn't fit in this sub-forum but oh well I'm making an exporter plugin for Maya and I want to export a non-triangulated mesh, while still outputting triangle data, not quad/n-gon data. Using MItMeshPolygon, I am doing the following: for (; !polyIter.isDone(); polyIter.next()) { //Get points and normals from current polygon MPointArray vts; polyIter.getPoints(vts); MVectorArray nmls; polyIter.getNormals(nmls); //Get number of triangles in current polygon int numberOfTriangles; polyIter.numTriangles(numberOfTriangles); //Loop through all triangles for (int i = 0; i < numberOfTriangles; i++) { //Get points and vertexList for this triangle. //vertexList is used to index into the polygon verts and normals. MPointArray points = {}; MIntArray vertexList = {}; polyIter.getTriangle(i, points, vertexList, MSpace::kObject); //For each vertex in this triangle for (int v = 0; v < 3; v++) { //Get point and normal UINT vi = polyIter.vertexIndex(vertexList[v]); UINT ni = polyIter.normalIndex(vertexList[v]); MPoint _v = vts[vi]; MFloatVector _n = nmls[ni]; //Create vertex Vertex_pos3nor3uv2 vert = {}; vert.posX = _v.x; vert.posY = _v.y; vert.posZ = _v.z * -1.0; vert.norX = _n.x; vert.norY = _n.y; vert.norZ = _n.z * -1.0; vert.u = 0.0; very.v = 0.0; verts.push_back(vert); } } } Doing this only gives me half the triangles I'm supposed to get and the result is very distorted. Link above is a picture of a cube exported this way. Edit: I've also tried indexing into the entire mesh vertex array like this: MPointArray vts; meshFn.getPoints(vts); MFloatVectorArray nmls; meshFn.getNormals(nmls); //.... UINT vi = polyIter.vertexIndex(vertexList[v]); UINT ni = polyIter.normalIndex(vertexList[v]); MPoint _v = vts[vi]; MFloatVector _n = nmls[vi]; I can't figure out what's wrong with my code. Any ideas?
  25. FreeType example

    Hi I've compiled: michael@michael-All-Series:~/CPP$ g++ example1.c -o ftypeexample -lfreetype -I/usr/include/freetype2 http://freetype.sourceforge.net/freetype2/docs/tutorial/example1.c but try to run on Ubuntu like: michael@michael-All-Series:~/CPP$ ./ftypeexample ./Ubuntu-B.ttf HELLO returns nothing. Thanks for help. Can i use that font in my small commercial app?
  • Advertisement