Yoyoyoyo

Members
  • Content count

    62
  • Joined

  • Last visited

Community Reputation

121 Neutral

About Yoyoyoyo

  • Rank
    Member
  1. Does my shader code look alright?

    Yeah it's redundant isn't it? I should remove the colour since it's not needed, but will it cause problems? It looks like the code is ok? Thank's for the feedback.
  2. Does my shader code look alright?

    I've used those semantics before no prob, afaik as long as the input layout matches it's good to go.
  3. Does my shader code look alright?

    My vertices contain position, colour and tex information. I have 1 constant buffer keeping track of world/view/proj, and that's about it. I am drawing a grid of vertices and expecting to see them, which i don't. I didn't think the problem was with my structs and functions here, so i just wanted a second opinion. From this code would you expect a minimal amount of vertices of type Pos/Col/Tex to be transformed correctly, and passed successfully through the vertex and pixel shader?
  4. [source lang="cpp"]cbuffer cbPerObject { float4x4 gWorldViewProj; }; Texture2D CubesTexture; SamplerState CubesTexSamplerState; ///////////////////////////// struct VS_inputVPCT { float3 Pos : POSITION; float4 Col : COLOUR; float2 Tex : TEXTURE; }; struct VS_outputVPCT { float4 Pos : SV_POSITION; float4 Col : COLOUR; float2 Tex : TEXTURE; }; struct PS_outputVPCT { float4 Col : COLOUR; float2 Tex : TEXTURE; }; /////////////////////////////// //////////////////////////////////////////////////// VS_outputVPCT VSfuncVPCT(VS_inputVPCT input) { VS_outputVPCT output; output.Pos = mul(float4(input.Pos, 1.0f), gWorldViewProj); output.Col = input.Col; output.Tex = input.Tex; return output; } PS_outputVPCT PSfuncVPCT(VS_outputVPCT input) : SV_Target { PS_outputVPCT output; output.Col = input.Col; output.Tex = CubesTexture.Sample(CubesTexSamplerState, input.Tex); return output; } ///////////////////////////////////////////////////////////////[/source] Thankyou for any assistance!
  5. Thank's, just what i wanted to hear Now i have got my first directx app up and running. Drinks on me.
  6. I know nothing of threading. If i were to use this method, would it be safe? Or does it require careful design and coding to ensure that the app remains single -threaded? Thanks.
  7. Reynolds number effect on Lift Coefficient

    That's fantastic, thanks!
  8. Hi, so my question is, what effect does the reynolds number have on the lift coefficient (and anything else for that matter)? I understand it's a measure of laminar vs turbulent airflow, and that it does effect the maximum lift coefficient. But i haven't found any information on how to incorporate it into an equation. Any help much appreciated. Thanks.
  9. Best 3D (Game) Programming Language

    C# You have your managed code, garbage collection and quick development.... But if you want it you can write 'unsafe' code and use pointers and avoid the CLR completely.... Nice ! So to me why bother with anything else? Java, C++ Pffff, C# has it all covered... /could be wrong
  10. XNA Animations and Kilowatt

    Hi im trying to get started with Kilowatt animation. And since i am fairly new to programming and xna, perhaps this can serve ultimately as a guide for noobs like me. I follow the instructions to include the solutions of the pipeline and animation from kilowatt. No prob i can load my model through this new pipeline and it doesn't spit out any errors, nice But i need to create an instance of AnimationInstance and also use the ModelDraw method, but how do i gain access to these classes? I try "using" but cannot find any reference to Kilowatt. Any help appreciated, thankyou.
  11. Thanks a lot Hodgman, quite right, i just had to say 'new Parent();' Thankyou for the help, it really is so great to have contact with people who know what they are doing
  12. The problem i was having i think, was using the 'Graphics Device' outside of the game class. I put my method into the game class and its all good. On another note i am running into a lot of 'reference not set to an instance of an object' errors. Here is an example; [code] class CelObj { public Parent[] parentFaces; public void RunSetup() { parentFaces = new Parent[6]; for (int x = 0; x < 6; x++) { parentFaces[x].BuildMesh(); This is where the error points to. Cannot 'BuildMesh' as object is not set to an instance. But as far as i can see i am creating a new instance inside the buildmesh method. See below. } ------- this is inside the Parent class; public Mesh mesh; public void BuildMesh() { mesh = new Mesh(); mesh.SetUpMeshes(mesh, width, length, cellSize); mesh.BuildVerticesTest(); mesh.CreateIndices(); mesh.genNormals(); } [/code] I figure, i create an array of Parent, which therefore instantiates each individual 'mesh' in the array, then simply call 'new mesh()' when i run my method. So as far as i can see, i have declared mesh object, and then before doing anything to it, i declare it as a new mesh. But alas the error is still there.
  13. Hi im just trying to tidy up my code and place all the Vertex buffer stuff neatly in a class. So everything is good up until i move the code over.. [code] public void LoadBuffers(IndexBuffer iBuffer, int nIndices, VertexBuffer vBuffer, int nVertices, short[] indices, GraphicsDevice device, VertexPositionNormalTexture[] vertices) { vBuffer = new VertexBuffer(device, typeof(VertexPositionNormalTexture), nVertices, BufferUsage.WriteOnly); iBuffer = new IndexBuffer(device, IndexElementSize.SixteenBits, nIndices, BufferUsage.WriteOnly); vBuffer.SetData<VertexPositionNormalTexture>(vertices); iBuffer.SetData<short>(indices); device.Indices = iBuffer; device.SetVertexBuffer(vBuffer); [/code] So it refuses to work, saying object reference not set to an instance of an object. Ive tried passing in already instanced buffers, but still no joy. All this code works fine placed in the game class, i just wanted to tidy it away in a nice class. Any tips appreciated. I haven't taken any classes in programming, and it's bound to be a simple c# language stumbling block for me.
  14. Little advice on XNA HLSL

    Hi, ive just started on HLSL and ive looked through every tutorial on the subject, but it's not clicking for me. I just want to add a directional light and have my normals that are already generated spring into action. Here's my effect code; [code] float4x4 World; float4x4 View; float4x4 Projection; // TODO: add effect parameters here. float AmbientIntensity = 1.9; float4 AmbientColor = float4(0.5,0.5,0.8,1); Texture mytexture; sampler ColoredTextureSampler = sampler_state { texture = <mytexture> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror; }; struct VertexShaderInput { float4 Position : POSITION0; // TODO: add input channels such as texture // coordinates and vertex colors here. float2 textureCoordinates : TEXCOORD0; float4 AmbientColor : COLOR0; float AmbientIntensity :COLOR1; float2 UV : TEXCOORD1; float3 Normal : TEXCOORD2; }; struct VertexShaderOutput { float4 Position : POSITION0; // TODO: add vertex shader outputs such as colors and texture // coordinates here. These values will automatically be interpolated // over the triangle, and provided as input to your pixel shader. float2 textureCoordinates : TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World); float4 viewPosition = mul(worldPosition, View); output.Position = mul(viewPosition, Projection); // TODO: add your vertex shader code here. output.textureCoordinates = input.textureCoordinates; return output; } float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { // TODO: add your pixel shader code here. float4 output = tex2D(ColoredTextureSampler, input.textureCoordinates) *(AmbientColor * AmbientIntensity); //output.AmbientColor *AmbientIntensity; return output; //return float4(0.8, 0.6, 0.3, 1); } technique Technique1 { pass Pass1 { // TODO: set renderstates here. VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } [/code] If anyone can suggest where and how i'd add the code for a directional light it would be much appreciated!
  15. Text RPG code problems

    [quote name='tasticmaster' timestamp='1306363253' post='4815804'] I am currently coding a very simple text RPG and so far everything is working well, but the code is starting to get confusing because of so many strings being used. How could I make the code work simpler and not require so many braces ("{" "}") [code] //Very simple text RPG #include <iostream> using namespace std; int main() { cout << "Hello and welcome to my game!" << endl; //greet the user cout << "What is your name?" << endl; //ask for name string name; //define name cin >> name; //read into name //write the greeting cout << "Hello , " << name << "!" << endl; cout << "You are about to embark on an epic journey" << endl; cout << "Good luck, " << name << endl; cout << "You are faced with a path, it forks off in two ways" << endl; cout << "Do you wish to go on the left path or right?" << endl; //first path choice cout << "Left (a)" << endl; cout << "Right (b)"<<endl; string path1; cin >> path1; if (path1 == "a") { cout << "You are faced with a very large ogre" << endl; //choice if you choose a cout << "Punch it (a)" << endl; cout << "Flee (b)" << endl; string path2; cin >> path2; if (path2 == "a") { cout << "Your strike deflects back off it's hard forehead" << endl; cout << "The ogre picks up a large boulder and smashes you with it" << endl; cout << "GAME OVER, " << name << "!" << endl; } if (path2 == "b") { cout << "Your desicion was wise. The ogre is slow!" << endl; cout << "You arrive at a strange swamp, a strange man is standing next to it" << endl; cout << "Attack him (a)" << endl; cout << "Attempt to speak to him (b)" << endl; string path21; cin >> path21; } } if (path1 == "b") { cout << "You arrive at a dead end, in front of you is a chest" << endl; //choice if you chose b cout << "Attempt to open it (a)" << endl; cout << "Run (b)" << endl; string path3; cin >> path3; } return 0; } [/code] Thank you. [/quote] You have achieved level 2 in programming lol. That's what i heard , first we start with lots of if blocks, then move onto object orientated, ie classes and that, then polymorphism, It's really satisfying making your own classes and methods