标签: material

在OpenGL中为不同对象设置单独的材质属性

如何为OpenGL中绘制的不同对象提供单独的材质属性?我做了以下代码,显然只显示了后面的颜色:

//************** Object 1 **************
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glColor4f(149.0/255.0, 78.0/255.0, 22.0/255.0, 1.0);
float mat_specular[] = {0.992157, 0.941176, 0.807843, 1.0};
float shininess = 10;

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialf(GL_FRONT, GL_SHININESS, shininess);

glPushMatrix();
glTranslatef(0, 3.0, 0);
drawSphere(0.1, 0.1, 0.1);
glRotatef(10, 1, 0, 0);

glDisable(GL_COLOR_MATERIAL);


//************** Object 2 *****************
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glColor4f(48.0/255.0, 48.0/255.0, 48.0/255.0, 1.0);
float mat_specular_2[] = {0.992157, 0.941176, 0.807843, 1.0};
float shininess_2 = 10;

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular_2);
glMaterialf(GL_FRONT, GL_SHININESS, shininess_2);

glPushMatrix();
glTranslatef(-0.6, 0.2, 1.6/2.0);
drawSphere(0.1, 0.1, 0.1);
glPopMatrix();

glDisable(GL_COLOR_MATERIAL);
Run Code Online (Sandbox Code Playgroud)

渲染时,对象2的颜色集用于整个场景.因此,尽管已经拥有自己的颜色集,但对象1也以对象2的颜色呈现.

如何让2个对象具有单独的材质属性,以便它们可以在整个场景中显示为不同的颜色而不只是一种颜色?

c++ opengl material

6
推荐指数
1
解决办法
8205
查看次数

使用CardView和浮动操作按钮Android创建布局

我想使用Material CardView和Custom Floating Action Button创建类似于以下图像的布局:在此输入图像描述

我开发了这个Layout xml文件,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:id="@+id/mainview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <android.support.v7.widget.CardView
            android:id="@+id/cv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="2dp"
            app:cardElevation="2dp"
            android:layout_marginBottom="@dimen/cardMarginVertical"
            android:layout_marginLeft="@dimen/cardMarginHorizontal"
            android:layout_marginRight="@dimen/cardMarginHorizontal"
            android:layout_marginTop="@dimen/cardMarginVertical"
            app:cardPreventCornerOverlap="false"
            app:contentPadding="0dp">

            <com.github.florent37.materialviewpager.sample.ExpandableTextView
                android:id="@+id/expandingTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="15dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginBottom="10dp"
                android:text="@string/longText" />

            <RelativeLayout
                android:id="@+id/buttonlayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/expandingTextView"
                android:layout_gravity="bottom"
                android:background="@android:color/transparent">

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/action_c"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:fab_colorNormal="#fff"
                    android:layout_alignParentRight="true"
                    fab:fab_colorPressed="#fff"
                    android:visibility="visible" />
            </RelativeLayout>
        </android.support.v7.widget.CardView>
    </RelativeLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

android material android-layout material-design

6
推荐指数
1
解决办法
6190
查看次数

MTL文件中的KE属性

我的.obj文件旁边有一个.mtl文件,它指定了对象的材质.我试图创建一个解析器但不知道"Ke"属性的含义.例如:

Ka 0.78 0.78 0.78 
Kd 0.78 0.78 0.78
Ks 0 0 0
Ke 17 12 4 # What does this line mean?
Run Code Online (Sandbox Code Playgroud)

谢谢 :)

3d wavefront material .obj

6
推荐指数
1
解决办法
1629
查看次数

Change color of matInput

How do I change matInput to a custom color. I want to change the placeholder and underline color.

I have read through most of the posts and could not find a solution to change the underline.

  <mat-form-field class="example-full-width">
    <input matInput placeholder="Favorite food" value="Sushi">
  </mat-form-field>
Run Code Online (Sandbox Code Playgroud)

Stackblitz example

Image example

material angular stackblitz

6
推荐指数
4
解决办法
1万
查看次数

将项目放到嵌套的下拉列表中(Angular 7 Material CDK)

我在Angular Material CDK的拖放功能方面遇到了问题。我正在尝试使用嵌套的DropList,该DropList可以嵌套任意深度。无法将项目拖到DropList的第三级中。除此之外,从第一级拖动到第二级时,这些项目来回跳动。

此处的解决方法解决了从第一个级别跳转到各个级别的问题。但这不能解决将项目放入第三层的问题。

我编写了一个最小且更复杂的示例来显示问题。

在复杂的示例中,从DropList中删除项目无效(似乎是模型无法刷新UI的问题,所以请不要介意。我正尝试尽快对其进行修复。)复杂的示例包括更多封装的组件。简单的只是处理拖放的两个组件。简单的示例包括上述解决方法,它解决了第一级和第二级之间的跳转问题。

我希望在将简单示例中的2拖到Composite 1.1的拖放区域(在Leaf 1.1.1Leaf 1.1.2之间)时,将把该项目拖放到Composite 1.1中。但这不会发生。此外,该项目在“ 复合1.1”框上方时会来回跳转。也许有人知道如何解决此问题...

material angular-material angular angular7

6
推荐指数
0
解决办法
676
查看次数

为Android中的芯片设置边框颜色

在我的Android应用中,我有一个看起来像这样的简单芯片。

在此处输入图片说明

有没有办法设置边框的颜色使其像这样?

在此处输入图片说明

更新:我尝试添加形状,但在布局夸大期间出现异常

 <android.support.design.chip.Chip
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:background="@drawable/chip_with_border"
     android:text="my chip" />
Run Code Online (Sandbox Code Playgroud)

drawable/chip_with_border.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#FFFFFF"/>
            <corners android:radius="30dp"/>
            <stroke android:width="1dp" android:color="#DDDDDD"/>
        </shape>
    </item>
</selector>
Run Code Online (Sandbox Code Playgroud)

这导致异常

android.view.InflateException:二进制XML文件第32行:错误膨胀了类android.support.design.chip.Chip

android material android-chips material-components material-components-android

6
推荐指数
2
解决办法
1126
查看次数

从Unity中的资源加载材料

在我的Assets文件夹中,我有一个名为Material的文件夹,其中我存储了所有需要的材料,Material文件夹中的一个材料Night_Sky,我想在游戏的某个时刻替换day_sky并设置Night_sky为我的默认Skybox.我尝试了很多代码,所有代码都返回null对象,例如:

night = Resources.Load("Material", typeof(Material)) as Material;
Run Code Online (Sandbox Code Playgroud)

要么

night = Resources.Load("Material/Night_Sky.mat", typeof(Material)) as Material;
Run Code Online (Sandbox Code Playgroud)

如何加载我的Night_Sky素材,或者如果有更简单的方法来切换我的天空盒以night_sky感谢您分享它

assets unity-game-engine material unityscript

5
推荐指数
1
解决办法
8526
查看次数

角度材料自动完成搜索字符串中的任何位置?

https://material.angularjs.org/latest/#/demo/material.components.autocomplete

请有人告诉我如何使自动填充(Angular材料)不仅在单词的开头,而且在单词中的任何位置搜索字符串.

例如,Alabama这个词:键入"Ala"时工作,但键入"bama"时不起作用.当我输入"bama"时,如何让它工作?

我知道我可以使用第三方指令,例如Angucomplete Alt:http://ghiden.github.io/angucomplete-alt/ 但我认为Angular材料应该有这个选项吗?

string search autocomplete material angularjs

5
推荐指数
2
解决办法
2670
查看次数

如何增加Angular Material datepicker的宽度

我有这样的事情:在此输入图像描述

如何使"招募日期"和"向下阵列"下的线路适应布局的一半,例如flex ="50".对于普通输入字段来说非常容易.

当前加价:

<md-content layout-padding> 
 <form> 
  <div layout-gt-xs="row"> 
   <md-input-container class="md-block" flex-gt-xs> 
      <label> date </label> 
      <md-datepicker ng-model="cv.contract.dateOfRecruitment"></md-datepicker> 
   </md-input-container>
   <md-input-container class="md-block" flex-gt-xs> 
      <label> months </label> 
          <input required ng-model="cv.contract.months" ng-pattern="/^[1-9][0-9]*$/" /> 
   </md-input-container> 
  </div>
 </form> 
</md-content>
Run Code Online (Sandbox Code Playgroud)

对不起的图片感到抱歉.您可能需要放大,因为Stackoverflow可以最小化它

html css material angularjs angular-material

5
推荐指数
1
解决办法
6193
查看次数

如何在React中使用动画材质的ui图标

https://material.io/design/iconography/animated-icons.html 我已在上面附加了链接,如何在我的React应用程序中集成图标却没有任何代码。

icons animation material reactjs material-ui

5
推荐指数
1
解决办法
1309
查看次数