|
@@ -87,6 +87,7 @@ Sidebar.Material = function ( editor ) {
|
|
|
'MeshToonMaterial': 'MeshToonMaterial',
|
|
|
'MeshStandardMaterial': 'MeshStandardMaterial',
|
|
|
'MeshPhysicalMaterial': 'MeshPhysicalMaterial',
|
|
|
+ 'RawShaderMaterial': 'RawShaderMaterial',
|
|
|
'ShaderMaterial': 'ShaderMaterial',
|
|
|
'SpriteMaterial': 'SpriteMaterial'
|
|
|
|
|
@@ -554,6 +555,12 @@ Sidebar.Material = function ( editor ) {
|
|
|
|
|
|
material = new THREE[ materialClass.getValue() ]();
|
|
|
|
|
|
+ if ( material.type == "RawShaderMaterial" ) {
|
|
|
+
|
|
|
+ material.vertexShader = vertexShaderVariables + material.vertexShader;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
editor.execute( new SetMaterialCommand( currentObject, material, currentMaterialSlot ), 'New Material: ' + materialClass.getValue() );
|
|
|
// TODO Copy other references in the scene graph
|
|
|
// keeping name and UUID then.
|
|
@@ -1417,6 +1424,12 @@ Sidebar.Material = function ( editor ) {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+ var vertexShaderVariables = [
|
|
|
+ 'uniform mat4 projectionMatrix;',
|
|
|
+ 'uniform mat4 modelViewMatrix;\n',
|
|
|
+ 'attribute vec3 position;\n\n',
|
|
|
+ ].join( '\n' );
|
|
|
+
|
|
|
return container;
|
|
|
|
|
|
};
|