Search Results

Search found 4646 results on 186 pages for 'multi'.

Page 36/186 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • HLSL/XNA Ambient light texture mixed up with multi pass lighting

    - by Manu-EPITA
    I've been having some troubles lately with lighting. I have found a source on google which is working pretty good on the example. However, when I try to implement it to my current project, I am getting some very weird bugs. The main one is that my textures are "mixed up" when I only activate the ambient light, which means that a model gets the texture of another one . I am using the same effect for every meshes of my models. I guess this could be the problem, but I don't really know how to "reset" an effect for a new model. Is it possible? Here is my shader: float4x4 WVP; float4x4 WVP; float3x3 World; float3 Ke; float3 Ka; float3 Kd; float3 Ks; float specularPower; float3 globalAmbient; float3 lightColor; float3 eyePosition; float3 lightDirection; float3 lightPosition; float spotPower; texture2D Texture; sampler2D texSampler = sampler_state { Texture = <Texture>; MinFilter = anisotropic; MagFilter = anisotropic; MipFilter = linear; MaxAnisotropy = 16; }; struct VertexShaderInput { float4 Position : POSITION0; float2 Texture : TEXCOORD0; float3 Normal : NORMAL0; }; struct VertexShaderOutput { float4 Position : POSITION0; float2 Texture : TEXCOORD0; float3 PositionO: TEXCOORD1; float3 Normal : NORMAL0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; output.Position = mul(input.Position, WVP); output.Normal = input.Normal; output.PositionO = input.Position.xyz; output.Texture = input.Texture; return output; } float4 PSAmbient(VertexShaderOutput input) : COLOR0 { return float4(Ka*globalAmbient + Ke,1) * tex2D(texSampler,input.Texture); } float4 PSDirectionalLight(VertexShaderOutput input) : COLOR0 { //Difuze float3 L = normalize(-lightDirection); float diffuseLight = max(dot(input.Normal,L), 0); float3 diffuse = Kd*lightColor*diffuseLight; //Specular float3 V = normalize(eyePosition - input.PositionO); float3 H = normalize(L + V); float specularLight = pow(max(dot(input.Normal,H),0),specularPower); if(diffuseLight<=0) specularLight=0; float3 specular = Ks * lightColor * specularLight; //sum all light components float3 light = diffuse + specular; return float4(light,1) * tex2D(texSampler,input.Texture); } technique MultiPassLight { pass Ambient { VertexShader = compile vs_3_0 VertexShaderFunction(); PixelShader = compile ps_3_0 PSAmbient(); } pass Directional { PixelShader = compile ps_3_0 PSDirectionalLight(); } } And here is how I actually apply my effects: public void ApplyLights(ModelMesh mesh, Matrix world, Texture2D modelTexture, Camera camera, Effect effect, GraphicsDevice graphicsDevice) { graphicsDevice.BlendState = BlendState.Opaque; effect.CurrentTechnique.Passes["Ambient"].Apply(); foreach (ModelMeshPart part in mesh.MeshParts) { graphicsDevice.SetVertexBuffer(part.VertexBuffer); graphicsDevice.Indices = part.IndexBuffer; // Texturing graphicsDevice.BlendState = BlendState.AlphaBlend; if (modelTexture != null) { effect.Parameters["Texture"].SetValue( modelTexture ); } graphicsDevice.DrawIndexedPrimitives( PrimitiveType.TriangleList, part.VertexOffset, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount ); // Applying our shader to all the mesh parts effect.Parameters["WVP"].SetValue( world * camera.View * camera.Projection ); effect.Parameters["World"].SetValue(world); effect.Parameters["eyePosition"].SetValue( camera.Position ); graphicsDevice.BlendState = BlendState.Additive; // Drawing lights foreach (DirectionalLight light in DirectionalLights) { effect.Parameters["lightColor"].SetValue(light.Color.ToVector3()); effect.Parameters["lightDirection"].SetValue(light.Direction); // Applying changes and drawing them effect.CurrentTechnique.Passes["Directional"].Apply(); graphicsDevice.DrawIndexedPrimitives( PrimitiveType.TriangleList, part.VertexOffset, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount ); } } I am also applying this when loading the effect: effect.Parameters["lightColor"].SetValue(Color.White.ToVector3()); effect.Parameters["globalAmbient"].SetValue(Color.White.ToVector3()); effect.Parameters["Ke"].SetValue(0.0f); effect.Parameters["Ka"].SetValue(0.01f); effect.Parameters["Kd"].SetValue(1.0f); effect.Parameters["Ks"].SetValue(0.3f); effect.Parameters["specularPower"].SetValue(100); Thank you very much UPDATE: I tried to load an effect for each model when drawing, but it doesn't seem to have changed anything. I suppose it is because XNA detects that the effect has already been loaded before and doesn't want to load a new one. Any idea why?

    Read the article

  • how to replace multi string with a array node in js

    - by Rueta
    hi everyone! i here a Work and i don't know how to do it. i have a string here: <div class="demotext"> <p>this is demo string i demo want to demo use</p> </div> i create the array variable for demo: var demoarray = new array('a','b','c'); now i want replace 'demo' in string by array node, follow 'demo' one change to 'a' , 'demo' two change to 'b'....

    Read the article

  • Multi-module Maven build

    - by Don
    Hi, My project has a fairly deep graph of Maven modules. The root POM has the following plugin configured <plugins> <plugin> <groupId>org.jvnet</groupId> <artifactId>animal-sniffer</artifactId> <version>1.2</version> <configuration> <signature> <groupId>org.jvnet.animal-sniffer</groupId> <artifactId>java1.4</artifactId> <version>1.0</version> </signature> </configuration> </plugin> </plugins> If I invoke this target from the command line in the root directory via: mvn animal-sniffer:check Then it works fine as long as the current module extends (either directly or indirectly) from the root POM. However there are many children (or grandchildren) of the root module, which do not inherit from that module's POM. In this case, the goal fails because it cannot find the necessary configuration [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] One or more required plugin parameters are invalid/missing for 'animal-sniffer:check' [0] Inside the definition for plugin 'animal-sniffer' specify the following: <configuration> ... <signature>VALUE</signature> </configuration>. When configuring this plugin in the root module, is there any way to exclude a list of sub-modules either by name, or by packaging type? Thanks, Donal

    Read the article

  • plot multi graphs with 2 y axis in 1 graph

    - by lytheone
    Hello, Currently I have a a text file with data at the first row is formatted as follow: time;wave height 1;wave height 2;....... I have column until wave height 19 and rows total 4000 rows. Data in the first column is time in second. From 2nd column onwards, it is wave height elevation which is in meter. I would like to plot the follow: ![alt text][1] on the x axis is time. the left hand side is wave height in m and on the right hand side is the distance between each measurment in a model. inside the graph there are 4 plots, each plot is repersent waveight 1, wave height 2etc at a defined distance related to the right hand side y asix. How would you code this in matlab? I am a begineer, please if you could, it will be very useful to give a bit more explain in your answer! Thank you!!!!!!!!!!

    Read the article

  • Converting part of a multi-purpose XML file to RSS using XSL

    - by Nate McCloud
    I have an XML file that I use for storing and displaying recipes that I collect, but that same XML file also has updates for the site at the top of it. How would I, say, use Recipes.xsl to transform Recipes.xml for display as an actual website, and use RecipesRSS.xsl to transform Recipes.xml into Recipes.rss? Currently, my XML file is formatted something like this: <book> <updates> <update when="2010-04-19"> <format> <update>Formatting updates here, if any. Otherwise, omit the Format section.</update> ... </format> <recipes> <update>Recipe updates here, if any. Otherwise, omit the Recipes section.</update> ... </recipes> </update> ... </updates> <recipe name="Recipe Name"> <from>Recipe source</from> <category>Recipe category</category> <ingredients> <ingredient>Recipe ingredient</ingredient> ... </ingredients> <instructions> <step>Recipe instructions go here.</step> ... </instructions> <notes> <note>Additional notes go here, if any. Otherwise, Notes section is omitted.</note> ... </notes> </recipe> ... </book> Any help would be greatly appreciated.

    Read the article

  • How to design a grid in Android (for multi-screen)

    - by Cris
    Hello, i need to realize an app for Android using this background image: Over every cell i have to draw a TextView, but i don't know how to do it with the different screens; i have the background image with 3 resolutions (240x320, 320x480, 480x800) but i don't know what kind of layout to use; i would use GridView but i don't know if i can work with different column size. Can anyone help me? Thanks in advance

    Read the article

  • How to use WebSockets refresh multi-window for play framework 1.2.7

    - by user2468652
    My code can work.But only refresh a page of one window. If I open window1 and window2 , both open websocket connect. I keyin word "test123" in window1, click sendbutton. Only refresh window1. How to refresh window1 and window2 ? Client <script> window.onload = function() { document.getElementById('sendbutton').addEventListener('click', sendMessage,false); document.getElementById('connectbutton').addEventListener('click', connect, false); } function writeStatus(message) { var html = document.createElement("div"); html.setAttribute('class', 'message'); html.innerHTML = message; document.getElementById("status").appendChild(html); } function connect() { ws = new WebSocket("ws://localhost:9000/ws?name=test"); ws.onopen = function(evt) { writeStatus("connected"); } ws.onmessage = function(evt) { writeStatus("response: " + evt.data); } } function sendMessage() { ws.send(document.getElementById('messagefield').value); } </script> </head> <body> <button id="connectbutton">Connect</button> <input type="text" id="messagefield"/> <button id="sendbutton">Send</button> <div id="status"></div> </body> Play Framework WebSocketController public class WebSocket extends WebSocketController { public static void test(String name) { while(inbound.isOpen()) { WebSocketEvent evt = await(inbound.nextEvent()); if(evt instanceof WebSocketFrame) { WebSocketFrame frame = (WebSocketFrame)evt; System.out.println("received: " + frame.getTextData()); if(!frame.isBinary()) { if(frame.getTextData().equals("quit")) { outbound.send("Bye!"); disconnect(); } else { outbound.send("Echo: %s", frame.getTextData()); } } } } } }

    Read the article

  • Text input for multi-valued attribute

    - by Sean
    I need to create an input form that will allow a user to enter any number of values for a particular attribute. I've tried several approaches, all of which seem to have various levels of failure. The latest model bean looks something like: public class Product { private String name; private String[] tags; ...accessors... } The input fields look something like: <h:inputText id="name" value="#{product.name}"></h:inputText> <h:inputText id="tag0" value="#{product.tag[0]}"></h:inputText> My plan was to allow the user is to use javascript to add additional form fields as needed. This type of setup gives me a 'Target Unreachable' error. What am I missing? I am using JSF 1.1 on WebSphere 6.1

    Read the article

  • Multi-Column Primary Key in MySQL 5

    - by Kaji
    I'm trying to learn how to use keys and to break the habit of necessarily having SERIAL type IDs for all rows in all my tables. At the same time, I'm also doing many-to-many relationships, and so requiring unique values on either column of the tables that coordinate the relationships would hamper that. How can I define a primary key on a table such that any given value can be repeated in any column, so long as the combination of values across all columns is never repeated exactly?

    Read the article

  • Vim: multi-file editing - having different makes in different splits

    - by gmatt
    I'm a recent vim convert (from fancy IDEs like eclipse.) I love the :make command in vim and use it extensively; however I also like to edit multiple projects (with separate makefiles.) So usually to edit more than one project I will do pushd project1 vim project1.cpp [suspend signal] pushd ../project2 vim project2.cpp and now I can switch between the two projects with ctrl+z i.e. suspend signal, and fg. When this becomes an issue is when I want to open one project in the context of another so I can do copy/pasting. So if instead in the above I do pushd project1 vim project1.cpp :vsp ../project2/project2.cpp I can edit both concurrently in the same vim process, however I can't effectively build one or the other with the :make command, it will only build project 1. Does anyone have some kind of scheme that gives them the best of both worlds: being able to edit concurrently while still being able to build multiple projects with the :make command all from the same vim process?

    Read the article

  • Indexes and multi column primary keys

    - by David Jenings
    Went searching and didn't find the answer to this specific noob question. My apologies if I missed it. In a MySQL database I have a table with the following primary key PRIMARY KEY id (invoice, item) In my application I will also frequently be selecting on "item" by itself and less frequently on only "invoice". I'm assuming I would benefit from indexes on these columns. MySQL does not complain when I define the following: INDEX (invoice), INDEX (item), PRIMARY KEY id (invoice, item) But I don't see any evidence (using DESCRIBE -- the only way I know how to look) that separate indexes have been established for these two columns. So the question is, are the columns that make up a primary key automatically indexed individually? Also, is there a better way than DESCRIBE to explore the structure of my table?

    Read the article

  • Output a php multi-dimensional array to a html table

    - by Fireflight
    I have been banging my head against the wall with this one for nearly a week now, and am no closer than I was the first day. I have a form that has 8 columns and a variable number of rows which I need to email to the client in a nicely formatted email. The form submits the needed fields as a multidimensional array. Rough example is below: <input name="order[0][topdiameter]" type="text" id="topdiameter0" value="1" size="5" /> <input name="order[0][bottomdiameter]" type="text" id="bottomdiameter0" value="1" size="5" /> <input name="order[0][slantheight]" type="text" id="slantheight0" value="1" size="5" /> <select name="order[0][fittertype]" id="fittertype0"> <option value="harp">Harp</option> <option value="euro">Euro</option> <option value="bulbclip">Regular</option> </select> <input name="order[0][washerdrop]" type="text" id="washerdrop0" value="1" size="5" /> <select name="order[0][fabrictype]" id="fabrictype"> <option value="linen">Linen</option> <option value="pleated">Pleated</option> </select> <select name="order[0][colours]" id="colours0"> <option value="beige">Beige</option> <option value="white">White</option> <option value="eggshell">Eggshell</option> <option value="parchment">Parchment</option> </select> <input name="order[0][quantity]" type="text" id="quantity0" value="1" size="5" /> This form is formatted in a table, and rows can be added to it dynamically. What I've been unable to do is get a properly formatted table out of the array. This is what I'm using now (grabbed from the net). <?php if (isset($_POST["submit"])) { $arr= $_POST['order'] echo '<table>'; foreach($arr as $arrs) { echo '<tr>'; foreach($arrs as $item) { echo "<td>$item</td>"; } echo '</tr>'; } echo '</table>; }; ?> This works perfectly for a single row of data. If I try submitting 2 or more rows from the form then one of the columns disappears. I'd like the table to be formatted as: | top | Bottom | Slant | Fitter | Washer | Fabric | Colours | Quantity | ------------------------------------------------------------------------ |value| value | value | value | value | value | value | value | with additional rows as needed. But, I can't find any examples that will generate that type of table! It seems like this should be something fairly straightforward, but I just can't locate an example that works the way I need it too.

    Read the article

  • Keeping DB Table sorted using multi-field formula (Microsoft SQL Server)

    - by user298167
    I have a JOB table, with two interesting columns: Creation Date Importance (high - 3, medium 2, low - 1). A JOB record's priority calculated like this: Priority = Importance * (time passed since creation) The problem is, every time I would like to pick 200 jobs with highest priority, and I don't want to resort the table. Is there a way to keep rows sorted? I was also thinking about having three tables one for High, Medium and Low and then sort those by Creation Date.

    Read the article

  • List View Selected Index Changed in a multi-selectable list view

    - by Anton Indrawan
    I have a windows form with a listview control. I set the MultiSelect property to true and I added a selected_index changed event. I get the event fired when I click the same index as the current selected index. My expectation is that I will not get the event fired. The strange thing is that the event fired 1 second after I click the index. I appreciate for any reply to explain why this is happening.

    Read the article

  • help with multi dimentional arrays

    - by sarmenhb11
    hi, i am building a shopping cart and cant figure out how to store something like this into a session. [product_id1] = quantity; [product_id1] = size [product_id1] = color; [product_id2] = quantity; [product_id2] = size; [product_id2] = color; ... etc so when a user select the quantity of a product then selects its color then selects to add to a cart i want the items selected to be added into a session and each item added to the cart , its attributes selected to be added into a session. how would i do this? many many thanks.

    Read the article

  • Using jQuery or javascript to render json into multi-column table

    - by Scott Yu - UX designer
    I am trying to render a JSON into a HTML table. But the difficulty is making it so it loops through JSON and renders multiple columns if necessary. For the example below, what I want is this: Result wanted Result Wanted <table> <tr><th>AppName</th><td>App 1</td><td>App 2</td></tr> <tr><th>Last Modified</th><td>10/1/2012</td><td></td></tr> <tr><th>App Logo</th><td>10/1/2012</td><td></td></tr> blahblah </table> <table> <tr><th>AppName</th><td>App 1</td></tr> blahblah </table> JSON Example "Records": [ { "AppName": "App 1", "LastModified": "10/1/2012, 9:30AM", "ShipTo_Name": "Dan North", "ShipTo_Address": "Dan North", "ShipTo_Terms": "Dan North", "ShipTo_DueDate": "Dan North", "Items 1": [ { "Item_Name": "Repairs", "Item_Description": "Repair Work" } ] }, { "AppName": "App 2", "AppLogo": "http://www.google.com/logo.png", "LastModified": "10/1/2012, 9:30AM", "BillTo_Name": "Steve North", "Items 1": [ { "Item_Name": "Repairs", "Item_Description": "Repair Work" } ] } ], "Records": [ { "AppName": "App 1", "LastModified": "10/1/2012, 9:30AM", "ShipTo_Name": "222", "ShipTo_Address": "333 ", "ShipTo_Terms": "444", "ShipTo_DueDate": "5555", "Items 1": [ { "Item_Name": "Repairs", "Item_Description": "Repair Work" } ] } ], Code I am using now function CreateComparisonTable (arr,level,k) { var dumped_text = ""; if(!level) level = 0; //The padding given at the beginning of the line. var level_padding = ""; for(var j=0;j<level+1;j++) level_padding = "--"; if(typeof(arr) == 'object') { //Array/Hashes/Objects for (var item in arr) { var value = arr[item]; if (typeof(value) == 'object') { //If it is an array, if(item !=0) { dumped_text += '<tr><td>' + item + '<br>'; dumped_text += CreateComparisonTable(value,level+1); dumped_text += '</td></tr>'; } else { dumped_text += CreateComparisonTable(value,level, value.length); } } else { dumped_text += '<tr><td>' + level_padding + item + '</td><td>' + value + '</td></tr>'; } } } return dumped_text; } Jsfiddle here

    Read the article

  • Linking two models in a multi-model form

    - by Elliot
    Hey Guys, I have a nested multimodel form right now, using Users and Profiles. Users has_one profile, and Profile belongs_to Users. When the form is submitted, a new user is created, and a new profile is created, but they are not linked (this is the first obvious issue). The user's model has a profile_id row, and the profile's model has a user_id row. Here is the code for the form: <%= form_for(@user, :url => teams_path) do |f| %> <p><%= f.label :email %><br /> <%= f.text_field :email %></p> <p><%= f.label :password %><br /> <%= f.password_field :password %></p> <p><%= f.label :password_confirmation %><br /> <%= f.password_field :password_confirmation %></p> <%= f.hidden_field :role_id, :value => @role.id %></p> <%= f.hidden_field :company_id, :value => current_user.company_id %></p> <%= fields_for @user.profile do |profile_fields| %> <div class="field"> <%= profile_fields.label :first_name %><br /> <%= profile_fields.text_field :first_name %> </div> <div class="field"> <%= profile_fields.label :last_name %><br /> <%= profile_fields.text_field :last_name %> </div> <% end %> <p><%= f.submit "Sign up" %></p> <% end %> A second issue, is even though the username, and password are successfully created through the form for the user model, the hidden fields (role_id & company_id - which are also links to other models) are not created (even though they are part of the model) - the values are successfully shown in the HTML for those fields however. Any help would be great!

    Read the article

  • ASP.Net MVC - which is the best approach for multi select grouping using JQuery Dialog

    - by Rajeesh
    This is my scenario I have an view(page) with list of items, a user could select single or multiple items from this page and click on a "Add to Group" button. Then a modal dialog(JQuery dialog) will be shown, from that he could select group, then press the add button. Which causes the items selected in the parent page is added to that particular group. So, which is the best way to pass the selected items to the modal pop-up? Though the query string ? - what happens if the no:of items selected is large, will the url support that much characters Keep the list in the parent page in a javascript variable and return the selected group from the modal pop-up? Or is there is any other better option? Thanks, Rajeesh

    Read the article

  • a multi-component truth table for assembly

    - by Malfist
    Can someone help me convert this C if statement into something assembly can understand? if((plain>='a' && plain<='x') || (plain>='A' && plain <='X')){ code = plain+2; } plain is a char, which for assembly is stored in the al register. Any help would be appreciated.

    Read the article

  • designing multi module J2EE application

    - by user728947
    Might be my question is abstract or out of context, but i am asking here since i have little idea how this happens. I am wondering how big application/ platform break down there application in to multiple module and how they able to manage modules dependencies. For example in some E-commerce application they tend to break down it in various modules like pricing,promotions,shipping.import/export and many more. when we develop those application we hardly think about the underlying modules and how they have been designed to provides functionalists. Most of those module are not web-applications but are standalone module and not deployed in the web-app as jar files. can any one help me to understand how they break up things or is there any standard way to do this.any help/resources to get insight will really be helpful

    Read the article

  • Strategy for developing a multi function asp.net web application

    - by user247023
    I'm about to start a new project and want some advice on how to implement. I need a web application which contains a booking module for reserving timeslots, and a time management module which will enable employees to clock in / clock out. If I am writing an update to the time managment module, I don't want to disrupt the booking engine availability by releasing a new solution containing both modules. to make things more difficult, there is some shared functionality like common users, roles and security. Here's a suggestion I've gotten, which sounds a bit cruddy, but may be functional. Write a 'container' web application which consists of basically a frame, and authentication / security features. This then has links which, will load the 2 independantly built and released web applications into the frame. I can see that say, if I wanted to update the time management module, I would only need to build and release this separately, and the rest of the solution would be 'untouched' Any better alternatives?

    Read the article

  • Multi language CMS?

    - by Adam
    Is there any CMS such as expression engine or wordpress that allows a user to click a button and convert all the text to another language (it would have to be human generated otherwise it has too many mistakes probably). I'd like to know if there are any good solutions out there that work for real world use, in like business company websites.

    Read the article

  • MySQL multi CREATE TABLE syntax help?

    - by rlb.usa
    Hi guys, I'm trying to write a MySQL script that creates several tables. I have: CREATE TABLE `DataBase1`.`tbl_this`( ... ); CREATE TABLE `DataBase1`.`tbl_that`( ... ); ... (14 more) ... BUT, only the first CREATE TABLE statement is executed. I get no syntax errors. Erm, am I missing the MSSQL equivalent of GO ? What am I doing wrong here; how do I get this baby to run all the tables?

    Read the article

  • concatenate multi values in one record without duplication

    - by mikehjun
    I have a dbf table like below which is the result of one to many join from two tables. I want to have unique zone values from one Taxlot id field. table name: input table tid ----- zone 1 ------ A 1 ------ A 1 ------ B 1 ------ C 2 ------ D 2 ------ E 3 ------ C Desirable output table table name: input table tid ----- zone 1 ------ A, B, C 2 ------ D, E 3 ------ C I got some help but couldn't make it to work. inputTbl = r"C:\temp\input.dbf" taxIdZoningDict = {} searchRows = gp.searchcursor(inputTbl) searchRow = searchRows.next() while searchRow: if searchRow.TID in taxIdZoningDict: taxIdZoningDict[searchRow.TID].add(searchRow.ZONE) else: taxIdZoningDict[searchRow.TID] = set() #a set prevents dulpicates! taxIdZoningDict[searchRow.TID].add(searchRow.ZONE) searchRow = searchRows.next() outputTbl = r"C:\temp\output.dbf" gp.CreateTable_management(r"C:\temp", "output.dbf") gp.AddField_management(outputTbl, "TID", "LONG") gp.AddField_management(outputTbl, "ZONES", "TEXT", "", "", "20") tidList = taxIdZoningDict.keys() tidList.sort() #sorts in ascending order insertRows = gp.insertcursor(outputTbl) for tid in tidList: concatString = "" for zone in taxIdZoningDict[tid] concatString = concatString + zone + "," insertRow = insertRows.newrow() insertRow.TID = tid insertRow.ZONES = concatString[:-1] insertRows.insertrow(insertRow) del insertRow del insertRows

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >