In which shader should i put technique11 section - visual-studio-2013

In VS 2010 i used to have one shader file for VS and PS and at the end of the file i had some techniques declared.
With VS 2013 i forced to have separate files for VS and PS. Where should i put techniques section? It needs to see both procedures i think.
My techniques were like that:
technique11 TexNo
{
pass P0
{
SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_5_0, PS(false) ) );
}
}
technique11 TexYes
{
pass P0
{
SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_5_0, PS(true) ) );
}
}

Related

Why is this Threejs cloned Group loaded via GLTFLoader misbehaving?

So I am trying to clone the soldier model from the Three.js examples, because I want more than one later:
https://threejs.org/examples/webgl_animation_skinning_blending.html
I changed line 93 to read:
const loader = new GLTFLoader();
loader.load( 'https://threejs.org/examples/models/gltf/Soldier.glb', function ( gltf ) {
model = gltf.scene.clone();
scene.add( model );
model.traverse( function ( object ) {
if ( object.isMesh ) object.castShadow = true;
} );
But now the soldier is huge.
Why is this happening and is there a fix for it?
Here is a jsfiddle showing the problem:
https://jsfiddle.net/paranoidray/jLpzk374/22/
If you check out the jsfiddle and change line 93 and remove the clone() call.
Everything works again...
Any help would be very much appreciated.
Please clone gltf.scene like so:
model = SkeletonUtils.clone( gltf.scene );
Cloning of skinned meshes is not yet supported in the core. However, you can use SkeletonUtils.clone() to perform this task.
https://jsfiddle.net/yesxrq7g/

How to access loaded model with objectLoader

I am trying to load an external model using ObjectLoader. I am using the following code
loader.load( 'teapot.obj', function ( object ) {
globalobject=object;
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material.map = texture;
console.log(child);
child.position.x = 3;
child.position.y = -6;
child.position.z = -17;
child.scale.x=.04;
child.scale.y=.04;
child.scale.z=.04;
child.name='tea';
scene.add( child );
}
});
But when I try to access this object in my render method using the following code it shows error
scene.getObjectByName('tea').rotation.z+=.01;
I saw using console that scene.getObjectByName('tea') is undefined
I can use all other standard Mesh objects using the above command but what is the problem with my object loaded using loader?
Can anyone help me to get the way?
If you have multiple childs in one obj file then append some number to differentiate between multiple mesh.
Then this should work:
scene.getObjectByName( "objectName" );
This answer may help

Additional parameters of GUILayout.Label

The Unity manual does not give examples of the params in the following particular version of GUILayout.Label (or is it somewhere else that I cannot seem to find?)
public static void Label(Texture image, GUIStyle style, params GUILayoutOption[] options);
So, I am wondering how to change the font size of the following code that I am dealing with:
I have a normal OnGUI() in an Editor file:
GUILayout.BeginHorizontal( displayStyle1 );
GUILayout.Label( "Has title?" );
if ( hasTitle )
{
if( GUILayout.Button( "yes", GUILayout.Width(40) ) )
{
hasTitle = true;
}
GUILayout.EndHorizontal();
}
and I have my own MyOnGUI() in an Executor file:
if( fieldInput.HasTitle )
{
GUILayout.BeginHorizontal( displayStyle1 );
GUILayout.Label( fieldInput.Title, displayStyle1 );
GUILayout.EndHorizontal();
}
Once you press yes and enter the title in the Editor, what you get after the Executor runs needs to be in bigger font, so I thought I should modify this line:
GUILayout.Label( fieldInput.Title, displayStyle1 );
therefore, I need to see an example of how to specify a bigger font as 3rd parameter...
Is this possible? Is it the right way of directly changing font size without modifying the set styles?
var style= GUI.skin.GetStyle("label");
style.fontSize = 24; // whatever you set
GUILayout.Label( fieldInput.Title, style);

Joomla Plugin not running (is installed)

I have "written" a plugin for Joomla! I say "written" because it is actually someone else's, but it was for Joomla 1.5, and I'm trying to upgrade it to run in Joomla 1.7. However, it's installed and it doesn't want to run. I have tried making it generate an error out of nothing, but it wouldn't give me anything.
I'm not even sure if it is Joomla 1.7 code or not, but I'm hoping you could help with that too.
<?php
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
jimport('joomla.plugin.plugin');
class plgContentRegisteredTags extends JPlugin
{
function plgContentRegisteredTags (&$subject, $params)
{
parent::__construct($subject,$params);
}
function onPrepareContent ( $context, &$article, &$params, $page=0 )
{
global $mainframe;
//if ( !$published ) return true;
// define the regular expression for the bot
$regex1 = "#{reg}(.*?){/reg}#s";
$regex2 = "#{noreg}(.*?){/noreg}#s";
// perform the replacement
$article->text = preg_replace_callback(
$regex1,
create_function(
'$matches',
'global $my;
if($my->id) return $matches[1];
return "";'
),
$article->text
);
$article->text = preg_replace_callback(
$regex2,
create_function(
'$matches',
'global $my;
if(!$my->id) return $matches[1];
return "";'
),
$article->text
);
return true;
}
}
Note: it just doesn't want to run at all (no error, no code execution), even though it is enabled and installed.
Any help would be appreciated.
Plugin-ins in Joomla! are stored in plugins/plugin-type/plugin_name/ relative to the site root. Components are stored in the components/ directory.
eg. the pagebreak content plugin is found at 'plugins/content/pagebreak/' and contains the files:
plugins/content/pagebreak/pagebreak.php
plugins/content/pagebreak/pagebreak.xml
plugins/content/pagebreak/index.html // not an active file
You can read about creating a content plugin here.

Visual Studio Plugin/Shortcut for Eclipse-like exception handler templates?

Maybe somebody help me with this. Assume we have to following line of code:
File.Delete("C:\\test.txt");
Most (not all) .NET developers will write a generic exception handler like this:
try
{
File.Delete("C:\\test.txt");
}
catch ( Exception e ) { //... }
...instead of the detailed version handling all exceptions listed in the documentation (MSDN - File.Delete Method):
try
{
File.Delete("C:\\test.txt");
}
catch ( ArgumentException arge ) { //... }
catch ( ArgumentNullException argne ) { //... }
catch ( DirectoryNotFoundException dnfe ) { //... }
catch ( IOException ioe ) { //... }
catch ( NotSupportedException nse ) { //... }
catch ( PathTooLongException ptle ) { //... }
catch ( UnauthorizedAccessException ptle ) { //... }
Why are so many .NET developers are writing generic exception handlers? The answer is because they are tired of looking up each exception in the API documentation (if there is a documentation at all).
Now to my question: Is there a Visual Studio plugin or unknown shortcut, which can do this for me? The Eclipse Java IDE has a buildin shortcut which exactly does this this automatically for the methods within the try-catch block.
I dont know of any such plugin existing for VS. Yes this is definitely a great feature to have and improves the coding experience. i would suggest you to submit your feedback in http://connect.microsoft.com/visualstudio and based on the votes we get for this feature request, the Visual Studio Team can plan it for their future releases.

Resources